mirror of
https://github.com/XiaoMi/ha_xiaomi_home.git
synced 2025-06-21 15:20:00 +08:00
feat:add missing parameter state_class (#101)
* feat: add state_class for sensor * feat: add optional state_class and unit_of_measurement for properties * feat:add support for state_class and unit process * style: fix pylint format * style: fix pylint format * sytle: change logic to suit conversation --------- Co-authored-by: LiShuzhen <SusanPhevos@gmail.com>
This commit is contained in:
@ -106,6 +106,9 @@ class Sensor(MIoTPropertyEntity, SensorEntity):
|
||||
# Set icon
|
||||
if spec.icon:
|
||||
self._attr_icon = spec.icon
|
||||
# Set state_class
|
||||
if spec.state_class:
|
||||
self._attr_state_class = spec.state_class
|
||||
|
||||
@property
|
||||
def native_value(self) -> Any:
|
||||
|
Reference in New Issue
Block a user