mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 21:27:38 +00:00
Fix invalid unit in econet (#83656)
This commit is contained in:
parent
f53145c540
commit
68efa37bff
@ -1,9 +1,9 @@
|
|||||||
"""Support for Rheem EcoNet water heaters."""
|
"""Support for Rheem EcoNet water heaters."""
|
||||||
from pyeconet.equipment import EquipmentType
|
from pyeconet.equipment import EquipmentType
|
||||||
|
|
||||||
from homeassistant.components.sensor import SensorDeviceClass, SensorEntity
|
from homeassistant.components.sensor import SensorEntity
|
||||||
from homeassistant.config_entries import ConfigEntry
|
from homeassistant.config_entries import ConfigEntry
|
||||||
from homeassistant.const import ENERGY_KILO_WATT_HOUR, PERCENTAGE, VOLUME_GALLONS
|
from homeassistant.const import PERCENTAGE, UnitOfEnergy, UnitOfVolume
|
||||||
from homeassistant.core import HomeAssistant
|
from homeassistant.core import HomeAssistant
|
||||||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||||
|
|
||||||
@ -39,10 +39,10 @@ SENSOR_NAMES_TO_UNIT_OF_MEASUREMENT = {
|
|||||||
AVAILABLE_HOT_WATER: PERCENTAGE,
|
AVAILABLE_HOT_WATER: PERCENTAGE,
|
||||||
COMPRESSOR_HEALTH: PERCENTAGE,
|
COMPRESSOR_HEALTH: PERCENTAGE,
|
||||||
OVERRIDE_STATUS: None,
|
OVERRIDE_STATUS: None,
|
||||||
WATER_USAGE_TODAY: VOLUME_GALLONS,
|
WATER_USAGE_TODAY: UnitOfVolume.GALLONS,
|
||||||
POWER_USAGE_TODAY: None, # Depends on unit type
|
POWER_USAGE_TODAY: None, # Depends on unit type
|
||||||
ALERT_COUNT: None,
|
ALERT_COUNT: None,
|
||||||
WIFI_SIGNAL: SensorDeviceClass.SIGNAL_STRENGTH,
|
WIFI_SIGNAL: None,
|
||||||
RUNNING_STATE: None, # This is just a string
|
RUNNING_STATE: None, # This is just a string
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -97,16 +97,16 @@ class EcoNetSensor(EcoNetEntity, SensorEntity):
|
|||||||
if self._econet.energy_type == ENERGY_KILO_BRITISH_THERMAL_UNIT.upper():
|
if self._econet.energy_type == ENERGY_KILO_BRITISH_THERMAL_UNIT.upper():
|
||||||
unit_of_measurement = ENERGY_KILO_BRITISH_THERMAL_UNIT
|
unit_of_measurement = ENERGY_KILO_BRITISH_THERMAL_UNIT
|
||||||
else:
|
else:
|
||||||
unit_of_measurement = ENERGY_KILO_WATT_HOUR
|
unit_of_measurement = UnitOfEnergy.KILO_WATT_HOUR
|
||||||
return unit_of_measurement
|
return unit_of_measurement
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def name(self):
|
def name(self) -> str:
|
||||||
"""Return the name of the entity."""
|
"""Return the name of the entity."""
|
||||||
return f"{self._econet.device_name}_{self._device_name}"
|
return f"{self._econet.device_name}_{self._device_name}"
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def unique_id(self):
|
def unique_id(self) -> str:
|
||||||
"""Return the unique ID of the entity."""
|
"""Return the unique ID of the entity."""
|
||||||
return (
|
return (
|
||||||
f"{self._econet.device_id}_{self._econet.device_name}_{self._device_name}"
|
f"{self._econet.device_id}_{self._econet.device_name}_{self._device_name}"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user