mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 13:17:32 +00:00
Use Unit enums in MELCloud sensors (#84036)
This commit is contained in:
parent
c4a01cf8d2
commit
30ac390471
@ -15,7 +15,7 @@ from homeassistant.components.sensor import (
|
|||||||
SensorStateClass,
|
SensorStateClass,
|
||||||
)
|
)
|
||||||
from homeassistant.config_entries import ConfigEntry
|
from homeassistant.config_entries import ConfigEntry
|
||||||
from homeassistant.const import ENERGY_KILO_WATT_HOUR, TEMP_CELSIUS
|
from homeassistant.const import UnitOfEnergy, UnitOfTemperature
|
||||||
from homeassistant.core import HomeAssistant
|
from homeassistant.core import HomeAssistant
|
||||||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||||
|
|
||||||
@ -43,7 +43,7 @@ ATA_SENSORS: tuple[MelcloudSensorEntityDescription, ...] = (
|
|||||||
key="room_temperature",
|
key="room_temperature",
|
||||||
name="Room Temperature",
|
name="Room Temperature",
|
||||||
icon="mdi:thermometer",
|
icon="mdi:thermometer",
|
||||||
native_unit_of_measurement=TEMP_CELSIUS,
|
native_unit_of_measurement=UnitOfTemperature.CELSIUS,
|
||||||
device_class=SensorDeviceClass.TEMPERATURE,
|
device_class=SensorDeviceClass.TEMPERATURE,
|
||||||
value_fn=lambda x: x.device.room_temperature,
|
value_fn=lambda x: x.device.room_temperature,
|
||||||
enabled=lambda x: True,
|
enabled=lambda x: True,
|
||||||
@ -52,7 +52,7 @@ ATA_SENSORS: tuple[MelcloudSensorEntityDescription, ...] = (
|
|||||||
key="energy",
|
key="energy",
|
||||||
name="Energy",
|
name="Energy",
|
||||||
icon="mdi:factory",
|
icon="mdi:factory",
|
||||||
native_unit_of_measurement=ENERGY_KILO_WATT_HOUR,
|
native_unit_of_measurement=UnitOfEnergy.KILO_WATT_HOUR,
|
||||||
device_class=SensorDeviceClass.ENERGY,
|
device_class=SensorDeviceClass.ENERGY,
|
||||||
value_fn=lambda x: x.device.total_energy_consumed,
|
value_fn=lambda x: x.device.total_energy_consumed,
|
||||||
enabled=lambda x: x.device.has_energy_consumed_meter,
|
enabled=lambda x: x.device.has_energy_consumed_meter,
|
||||||
@ -61,7 +61,7 @@ ATA_SENSORS: tuple[MelcloudSensorEntityDescription, ...] = (
|
|||||||
key="daily_energy",
|
key="daily_energy",
|
||||||
name="Daily Energy Consumed",
|
name="Daily Energy Consumed",
|
||||||
icon="mdi:factory",
|
icon="mdi:factory",
|
||||||
native_unit_of_measurement=ENERGY_KILO_WATT_HOUR,
|
native_unit_of_measurement=UnitOfEnergy.KILO_WATT_HOUR,
|
||||||
device_class=SensorDeviceClass.ENERGY,
|
device_class=SensorDeviceClass.ENERGY,
|
||||||
value_fn=lambda x: x.device.daily_energy_consumed,
|
value_fn=lambda x: x.device.daily_energy_consumed,
|
||||||
enabled=lambda x: True,
|
enabled=lambda x: True,
|
||||||
@ -72,7 +72,7 @@ ATW_SENSORS: tuple[MelcloudSensorEntityDescription, ...] = (
|
|||||||
key="outside_temperature",
|
key="outside_temperature",
|
||||||
name="Outside Temperature",
|
name="Outside Temperature",
|
||||||
icon="mdi:thermometer",
|
icon="mdi:thermometer",
|
||||||
native_unit_of_measurement=TEMP_CELSIUS,
|
native_unit_of_measurement=UnitOfTemperature.CELSIUS,
|
||||||
device_class=SensorDeviceClass.TEMPERATURE,
|
device_class=SensorDeviceClass.TEMPERATURE,
|
||||||
value_fn=lambda x: x.device.outside_temperature,
|
value_fn=lambda x: x.device.outside_temperature,
|
||||||
enabled=lambda x: True,
|
enabled=lambda x: True,
|
||||||
@ -81,7 +81,7 @@ ATW_SENSORS: tuple[MelcloudSensorEntityDescription, ...] = (
|
|||||||
key="tank_temperature",
|
key="tank_temperature",
|
||||||
name="Tank Temperature",
|
name="Tank Temperature",
|
||||||
icon="mdi:thermometer",
|
icon="mdi:thermometer",
|
||||||
native_unit_of_measurement=TEMP_CELSIUS,
|
native_unit_of_measurement=UnitOfTemperature.CELSIUS,
|
||||||
device_class=SensorDeviceClass.TEMPERATURE,
|
device_class=SensorDeviceClass.TEMPERATURE,
|
||||||
value_fn=lambda x: x.device.tank_temperature,
|
value_fn=lambda x: x.device.tank_temperature,
|
||||||
enabled=lambda x: True,
|
enabled=lambda x: True,
|
||||||
@ -90,7 +90,7 @@ ATW_SENSORS: tuple[MelcloudSensorEntityDescription, ...] = (
|
|||||||
key="daily_energy",
|
key="daily_energy",
|
||||||
name="Daily Energy Consumed",
|
name="Daily Energy Consumed",
|
||||||
icon="mdi:factory",
|
icon="mdi:factory",
|
||||||
native_unit_of_measurement=ENERGY_KILO_WATT_HOUR,
|
native_unit_of_measurement=UnitOfEnergy.KILO_WATT_HOUR,
|
||||||
device_class=SensorDeviceClass.ENERGY,
|
device_class=SensorDeviceClass.ENERGY,
|
||||||
value_fn=lambda x: x.device.daily_energy_consumed,
|
value_fn=lambda x: x.device.daily_energy_consumed,
|
||||||
enabled=lambda x: True,
|
enabled=lambda x: True,
|
||||||
@ -101,7 +101,7 @@ ATW_ZONE_SENSORS: tuple[MelcloudSensorEntityDescription, ...] = (
|
|||||||
key="room_temperature",
|
key="room_temperature",
|
||||||
name="Room Temperature",
|
name="Room Temperature",
|
||||||
icon="mdi:thermometer",
|
icon="mdi:thermometer",
|
||||||
native_unit_of_measurement=TEMP_CELSIUS,
|
native_unit_of_measurement=UnitOfTemperature.CELSIUS,
|
||||||
device_class=SensorDeviceClass.TEMPERATURE,
|
device_class=SensorDeviceClass.TEMPERATURE,
|
||||||
value_fn=lambda zone: zone.room_temperature,
|
value_fn=lambda zone: zone.room_temperature,
|
||||||
enabled=lambda x: True,
|
enabled=lambda x: True,
|
||||||
@ -110,7 +110,7 @@ ATW_ZONE_SENSORS: tuple[MelcloudSensorEntityDescription, ...] = (
|
|||||||
key="flow_temperature",
|
key="flow_temperature",
|
||||||
name="Flow Temperature",
|
name="Flow Temperature",
|
||||||
icon="mdi:thermometer",
|
icon="mdi:thermometer",
|
||||||
native_unit_of_measurement=TEMP_CELSIUS,
|
native_unit_of_measurement=UnitOfTemperature.CELSIUS,
|
||||||
device_class=SensorDeviceClass.TEMPERATURE,
|
device_class=SensorDeviceClass.TEMPERATURE,
|
||||||
value_fn=lambda zone: zone.flow_temperature,
|
value_fn=lambda zone: zone.flow_temperature,
|
||||||
enabled=lambda x: True,
|
enabled=lambda x: True,
|
||||||
@ -119,7 +119,7 @@ ATW_ZONE_SENSORS: tuple[MelcloudSensorEntityDescription, ...] = (
|
|||||||
key="return_temperature",
|
key="return_temperature",
|
||||||
name="Flow Return Temperature",
|
name="Flow Return Temperature",
|
||||||
icon="mdi:thermometer",
|
icon="mdi:thermometer",
|
||||||
native_unit_of_measurement=TEMP_CELSIUS,
|
native_unit_of_measurement=UnitOfTemperature.CELSIUS,
|
||||||
device_class=SensorDeviceClass.TEMPERATURE,
|
device_class=SensorDeviceClass.TEMPERATURE,
|
||||||
value_fn=lambda zone: zone.return_temperature,
|
value_fn=lambda zone: zone.return_temperature,
|
||||||
enabled=lambda x: True,
|
enabled=lambda x: True,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user