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:
tiger
2025-01-03 20:42:34 +08:00
committed by GitHub
parent da90e099d1
commit 5438698a6e
4 changed files with 71 additions and 5 deletions

View File

@ -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: