From aedb0a3ca49a890476c0ce45fafada1eaf97d336 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Jaworski?= Date: Wed, 5 Jun 2024 12:17:56 +0200 Subject: [PATCH] Add new sensors to blebox (#118837) blebox: add mapping for new sensor types introduced in blebox_uniapi>-2.4.0 Co-authored-by: Erik Montnemery --- homeassistant/components/blebox/sensor.py | 52 +++++++++++++++++++++++ 1 file changed, 52 insertions(+) diff --git a/homeassistant/components/blebox/sensor.py b/homeassistant/components/blebox/sensor.py index 5aff62eb11e..2642bfd0139 100644 --- a/homeassistant/components/blebox/sensor.py +++ b/homeassistant/components/blebox/sensor.py @@ -12,8 +12,15 @@ from homeassistant.components.sensor import ( from homeassistant.config_entries import ConfigEntry from homeassistant.const import ( CONCENTRATION_MICROGRAMS_PER_CUBIC_METER, + LIGHT_LUX, PERCENTAGE, + POWER_VOLT_AMPERE_REACTIVE, + UnitOfApparentPower, + UnitOfElectricCurrent, + UnitOfElectricPotential, UnitOfEnergy, + UnitOfFrequency, + UnitOfPower, UnitOfSpeed, UnitOfTemperature, ) @@ -60,6 +67,51 @@ SENSOR_TYPES = ( device_class=SensorDeviceClass.WIND_SPEED, native_unit_of_measurement=UnitOfSpeed.METERS_PER_SECOND, ), + SensorEntityDescription( + key="illuminance", + device_class=SensorDeviceClass.ILLUMINANCE, + native_unit_of_measurement=LIGHT_LUX, + ), + SensorEntityDescription( + key="forwardActiveEnergy", + device_class=SensorDeviceClass.ENERGY, + native_unit_of_measurement=UnitOfEnergy.KILO_WATT_HOUR, + ), + SensorEntityDescription( + key="reverseActiveEnergy", + device_class=SensorDeviceClass.ENERGY, + native_unit_of_measurement=UnitOfEnergy.KILO_WATT_HOUR, + ), + SensorEntityDescription( + key="reactivePower", + device_class=SensorDeviceClass.POWER, + native_unit_of_measurement=POWER_VOLT_AMPERE_REACTIVE, + ), + SensorEntityDescription( + key="activePower", + device_class=SensorDeviceClass.POWER, + native_unit_of_measurement=UnitOfPower.WATT, + ), + SensorEntityDescription( + key="apparentPower", + device_class=SensorDeviceClass.APPARENT_POWER, + native_unit_of_measurement=UnitOfApparentPower.VOLT_AMPERE, + ), + SensorEntityDescription( + key="voltage", + device_class=SensorDeviceClass.VOLTAGE, + native_unit_of_measurement=UnitOfElectricPotential.VOLT, + ), + SensorEntityDescription( + key="current", + device_class=SensorDeviceClass.CURRENT, + native_unit_of_measurement=UnitOfElectricCurrent.MILLIAMPERE, + ), + SensorEntityDescription( + key="frequency", + device_class=SensorDeviceClass.FREQUENCY, + native_unit_of_measurement=UnitOfFrequency.HERTZ, + ), )