Use UnitOfEnergy in integrations (o-z) (#84221)

This commit is contained in:
epenet 2022-12-19 10:58:37 +01:00 committed by GitHub
parent 3168b30535
commit ebdf9a8658
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
29 changed files with 120 additions and 134 deletions

View file

@ -22,10 +22,9 @@ from homeassistant.const import (
ATTR_UNIT_OF_MEASUREMENT,
CONF_NAME,
CONF_UNIQUE_ID,
ENERGY_KILO_WATT_HOUR,
ENERGY_WATT_HOUR,
STATE_UNAVAILABLE,
STATE_UNKNOWN,
UnitOfEnergy,
)
from homeassistant.core import HomeAssistant, callback
from homeassistant.helpers import entity_platform, entity_registry as er
@ -88,8 +87,8 @@ ATTR_LAST_PERIOD = "last_period"
ATTR_TARIFF = "tariff"
DEVICE_CLASS_MAP = {
ENERGY_WATT_HOUR: SensorDeviceClass.ENERGY,
ENERGY_KILO_WATT_HOUR: SensorDeviceClass.ENERGY,
UnitOfEnergy.WATT_HOUR: SensorDeviceClass.ENERGY,
UnitOfEnergy.KILO_WATT_HOUR: SensorDeviceClass.ENERGY,
}
ICON = "mdi:counter"