Skip to content

Commit

Permalink
Update types.py
Browse files Browse the repository at this point in the history
Fix warning UnitOfEnergy.KILO_WATT_HOUR
  • Loading branch information
duongcuong8896 authored Oct 14, 2024
1 parent 5ff8793 commit 12d8442
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions custom_components/nestup_evn/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
SensorEntityDescription,
SensorStateClass,
)
from homeassistant.const import ENERGY_KILO_WATT_HOUR
from homeassistant.const import UnitOfEnergy

from .const import (
ID_ECON_DAILY_NEW,
Expand Down Expand Up @@ -129,7 +129,7 @@ class EVNSensorEntityDescription(SensorEntityDescription, EVNRequiredKeysMixin):
key=ID_ECON_DAILY_NEW,
name="Sản lượng",
icon="mdi:flash-outline",
native_unit_of_measurement=ENERGY_KILO_WATT_HOUR,
native_unit_of_measurement=UnitOfEnergy.KILO_WATT_HOUR,
device_class=SensorDeviceClass.ENERGY,
value_fn=lambda data: data[ID_ECON_DAILY_NEW],
dynamic_name=True,
Expand All @@ -147,7 +147,7 @@ class EVNSensorEntityDescription(SensorEntityDescription, EVNRequiredKeysMixin):
key=ID_ECON_DAILY_OLD,
name="Sản lượng",
icon="mdi:flash-outline",
native_unit_of_measurement=ENERGY_KILO_WATT_HOUR,
native_unit_of_measurement=UnitOfEnergy.KILO_WATT_HOUR,
device_class=SensorDeviceClass.ENERGY,
value_fn=lambda data: data[ID_ECON_DAILY_OLD],
dynamic_name=True,
Expand All @@ -165,7 +165,7 @@ class EVNSensorEntityDescription(SensorEntityDescription, EVNRequiredKeysMixin):
key=ID_ECON_MONTHLY_NEW,
name="Sản lượng tháng này",
icon="mdi:flash-outline",
native_unit_of_measurement=ENERGY_KILO_WATT_HOUR,
native_unit_of_measurement=UnitOfEnergy.KILO_WATT_HOUR,
device_class=SensorDeviceClass.ENERGY,
value_fn=lambda data: data[ID_ECON_MONTHLY_NEW],
),
Expand All @@ -181,7 +181,7 @@ class EVNSensorEntityDescription(SensorEntityDescription, EVNRequiredKeysMixin):
key=ID_ECON_TOTAL_NEW,
name="Chỉ số tạm chốt",
icon="mdi:arrow-up-bold-box-outline",
native_unit_of_measurement=ENERGY_KILO_WATT_HOUR,
native_unit_of_measurement=UnitOfEnergy.KILO_WATT_HOUR,
state_class=SensorStateClass.TOTAL_INCREASING,
device_class=SensorDeviceClass.ENERGY,
value_fn=lambda data: data[ID_ECON_TOTAL_NEW],
Expand All @@ -190,7 +190,7 @@ class EVNSensorEntityDescription(SensorEntityDescription, EVNRequiredKeysMixin):
key=ID_ECON_TOTAL_OLD,
name="Chỉ số đầu kì",
icon="mdi:arrow-down-bold-box-outline",
native_unit_of_measurement=ENERGY_KILO_WATT_HOUR,
native_unit_of_measurement=UnitOfEnergy.KILO_WATT_HOUR,
device_class=SensorDeviceClass.ENERGY,
value_fn=lambda data: data[ID_ECON_TOTAL_OLD],
),
Expand Down

0 comments on commit 12d8442

Please sign in to comment.