Fix MELCloud temperature unit (#35003)
The MELCLoud API produces and consumes only Celsius.
This commit is contained in:
1 parent
8ec5e53cf4
commit
66d3832be9
4 files changed
+16
-31
No files matched your search
@@ -12,11 +12,11 @@ from homeassistant.const import (
|
||||
from homeassistant.helpers.entity import Entity
|
||||
|
||||
from . import MelCloudDevice
|
||||
from .const import DOMAIN, TEMP_UNIT_LOOKUP
|
||||
from .const import DOMAIN
|
||||
|
||||
ATTR_MEASUREMENT_NAME = "measurement_name"
|
||||
ATTR_ICON = "icon"
|
||||
ATTR_UNIT_FN = "unit_fn"
|
||||
ATTR_UNIT = "unit"
|
||||
ATTR_DEVICE_CLASS = "device_class"
|
||||
ATTR_VALUE_FN = "value_fn"
|
||||
ATTR_ENABLED_FN = "enabled"
|
||||
@@ -25,7 +25,7 @@ ATA_SENSORS = {
|
||||
"room_temperature": {
|
||||
ATTR_MEASUREMENT_NAME: "Room Temperature",
|
||||
ATTR_ICON: "mdi:thermometer",
|
||||
ATTR_UNIT_FN: lambda x: TEMP_UNIT_LOOKUP.get(x.device.temp_unit, TEMP_CELSIUS),
|
||||
ATTR_UNIT: TEMP_CELSIUS,
|
||||
ATTR_DEVICE_CLASS: DEVICE_CLASS_TEMPERATURE,
|
||||
ATTR_VALUE_FN: lambda x: x.device.room_temperature,
|
||||
ATTR_ENABLED_FN: lambda x: True,
|
||||
@@ -33,7 +33,7 @@ ATA_SENSORS = {
|
||||
"energy": {
|
||||
ATTR_MEASUREMENT_NAME: "Energy",
|
||||
ATTR_ICON: "mdi:factory",
|
||||
ATTR_UNIT_FN: lambda x: ENERGY_KILO_WATT_HOUR,
|
||||
ATTR_UNIT: ENERGY_KILO_WATT_HOUR,
|
||||
ATTR_DEVICE_CLASS: None,
|
||||
ATTR_VALUE_FN: lambda x: x.device.total_energy_consumed,
|
||||
ATTR_ENABLED_FN: lambda x: x.device.has_energy_consumed_meter,
|
||||
@@ -43,7 +43,7 @@ ATW_SENSORS = {
|
||||
"outside_temperature": {
|
||||
ATTR_MEASUREMENT_NAME: "Outside Temperature",
|
||||
ATTR_ICON: "mdi:thermometer",
|
||||
ATTR_UNIT_FN: lambda x: TEMP_UNIT_LOOKUP.get(x.device.temp_unit, TEMP_CELSIUS),
|
||||
ATTR_UNIT: TEMP_CELSIUS,
|
||||
ATTR_DEVICE_CLASS: DEVICE_CLASS_TEMPERATURE,
|
||||
ATTR_VALUE_FN: lambda x: x.device.outside_temperature,
|
||||
ATTR_ENABLED_FN: lambda x: True,
|
||||
@@ -51,7 +51,7 @@ ATW_SENSORS = {
|
||||
"tank_temperature": {
|
||||
ATTR_MEASUREMENT_NAME: "Tank Temperature",
|
||||
ATTR_ICON: "mdi:thermometer",
|
||||
ATTR_UNIT_FN: lambda x: TEMP_UNIT_LOOKUP.get(x.device.temp_unit, TEMP_CELSIUS),
|
||||
ATTR_UNIT: TEMP_CELSIUS,
|
||||
ATTR_DEVICE_CLASS: DEVICE_CLASS_TEMPERATURE,
|
||||
ATTR_VALUE_FN: lambda x: x.device.tank_temperature,
|
||||
ATTR_ENABLED_FN: lambda x: True,
|
||||
@@ -61,7 +61,7 @@ ATW_ZONE_SENSORS = {
|
||||
"room_temperature": {
|
||||
ATTR_MEASUREMENT_NAME: "Room Temperature",
|
||||
ATTR_ICON: "mdi:thermometer",
|
||||
ATTR_UNIT_FN: lambda x: TEMP_UNIT_LOOKUP.get(x.device.temp_unit, TEMP_CELSIUS),
|
||||
ATTR_UNIT: TEMP_CELSIUS,
|
||||
ATTR_DEVICE_CLASS: DEVICE_CLASS_TEMPERATURE,
|
||||
ATTR_VALUE_FN: lambda zone: zone.room_temperature,
|
||||
ATTR_ENABLED_FN: lambda x: True,
|
||||
@@ -147,7 +147,7 @@ class MelDeviceSensor(Entity):
|
||||
@property
|
||||
def unit_of_measurement(self):
|
||||
"""Return the unit of measurement."""
|
||||
return self._def[ATTR_UNIT_FN](self._api)
|
||||
return self._def[ATTR_UNIT]
|
||||
|
||||
@property
|
||||
def device_class(self):
|
||||
|
||||
Reference in new issue
Block a user