Use shorthand attributes in geniushub sensor (#100208)

This commit is contained in:
J. Nick Koston 2023-09-12 10:04:35 -05:00 committed by GitHub
parent 4e17901fef
commit 085a584d98
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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."""