diff --git a/homeassistant/components/xiaomi_aqara/const.py b/homeassistant/components/xiaomi_aqara/const.py index 58932d7a0bc..0eb117cdf3c 100644 --- a/homeassistant/components/xiaomi_aqara/const.py +++ b/homeassistant/components/xiaomi_aqara/const.py @@ -53,3 +53,9 @@ BATTERY_MODELS = [ "lock.aq1", "lock.acn02", ] + +POWER_MODELS = [ + "86plug", + "ctrl_86plug", + "ctrl_86plug.aq1", +] diff --git a/homeassistant/components/xiaomi_aqara/sensor.py b/homeassistant/components/xiaomi_aqara/sensor.py index 3463cded56d..471011eab6e 100644 --- a/homeassistant/components/xiaomi_aqara/sensor.py +++ b/homeassistant/components/xiaomi_aqara/sensor.py @@ -6,14 +6,16 @@ from homeassistant.const import ( DEVICE_CLASS_BATTERY, DEVICE_CLASS_HUMIDITY, DEVICE_CLASS_ILLUMINANCE, + DEVICE_CLASS_POWER, DEVICE_CLASS_PRESSURE, DEVICE_CLASS_TEMPERATURE, + POWER_WATT, TEMP_CELSIUS, UNIT_PERCENTAGE, ) from . import XiaomiDevice -from .const import BATTERY_MODELS, DOMAIN, GATEWAYS_KEY +from .const import BATTERY_MODELS, DOMAIN, GATEWAYS_KEY, POWER_MODELS _LOGGER = logging.getLogger(__name__) @@ -24,6 +26,7 @@ SENSOR_TYPES = { "lux": ["lx", None, DEVICE_CLASS_ILLUMINANCE], "pressure": ["hPa", None, DEVICE_CLASS_PRESSURE], "bed_activity": ["μm", None, None], + "load_power": [POWER_WATT, None, DEVICE_CLASS_POWER], } @@ -89,7 +92,12 @@ async def async_setup_entry(hass, config_entry, async_add_entities): entities.append( XiaomiBatterySensor(device, "Battery", gateway, config_entry) ) - + if device["model"] in POWER_MODELS: + entities.append( + XiaomiSensor( + device, "Load Power", "load_power", gateway, config_entry + ) + ) async_add_entities(entities)