Use shorthand attributes in geniushub sensor (#100208)
This commit is contained in:
parent
4e17901fef
commit
085a584d98
1 changed files with 3 additions and 10 deletions
|
@ -47,6 +47,9 @@ async def async_setup_platform(
|
|||
class GeniusBattery(GeniusDevice, SensorEntity):
|
||||
"""Representation of a Genius Hub sensor."""
|
||||
|
||||
_attr_device_class = SensorDeviceClass.BATTERY
|
||||
_attr_native_unit_of_measurement = PERCENTAGE
|
||||
|
||||
def __init__(self, broker, device, state_attr) -> None:
|
||||
"""Initialize the sensor."""
|
||||
super().__init__(broker, device)
|
||||
|
@ -80,16 +83,6 @@ class GeniusBattery(GeniusDevice, SensorEntity):
|
|||
|
||||
return icon
|
||||
|
||||
@property
|
||||
def device_class(self) -> SensorDeviceClass:
|
||||
"""Return the device class of the sensor."""
|
||||
return SensorDeviceClass.BATTERY
|
||||
|
||||
@property
|
||||
def native_unit_of_measurement(self) -> str:
|
||||
"""Return the unit of measurement of the sensor."""
|
||||
return PERCENTAGE
|
||||
|
||||
@property
|
||||
def native_value(self) -> str:
|
||||
"""Return the state of the sensor."""
|
||||
|
|
Loading…
Add table
Reference in a new issue