diff --git a/homeassistant/components/smappee/manifest.json b/homeassistant/components/smappee/manifest.json index 3ca8dc4b1b6..1c760376e04 100644 --- a/homeassistant/components/smappee/manifest.json +++ b/homeassistant/components/smappee/manifest.json @@ -5,7 +5,7 @@ "documentation": "https://www.home-assistant.io/integrations/smappee", "dependencies": ["http"], "requirements": [ - "pysmappee==0.1.2" + "pysmappee==0.1.4" ], "codeowners": [ "@bsmappee" diff --git a/homeassistant/components/smappee/sensor.py b/homeassistant/components/smappee/sensor.py index 61f7af05690..1b0b5af8564 100644 --- a/homeassistant/components/smappee/sensor.py +++ b/homeassistant/components/smappee/sensor.py @@ -16,13 +16,6 @@ TREND_SENSORS = { "total_power", DEVICE_CLASS_POWER, ], - "total_reactive_power": [ - "Total consumption - Reactive power", - None, - POWER_WATT, - "total_reactive_power", - DEVICE_CLASS_POWER, - ], "alwayson": [ "Always on - Active power", None, @@ -59,6 +52,15 @@ TREND_SENSORS = { None, ], } +REACTIVE_SENSORS = { + "total_reactive_power": [ + "Total consumption - Reactive power", + None, + POWER_WATT, + "total_reactive_power", + DEVICE_CLASS_POWER, + ] +} SOLAR_SENSORS = { "solar_power": [ "Total production - Active power", @@ -151,6 +153,17 @@ async def async_setup_entry(hass, config_entry, async_add_entities): ) ) + if service_location.has_reactive_value: + for reactive_sensor in REACTIVE_SENSORS: + entities.append( + SmappeeSensor( + smappee_base=smappee_base, + service_location=service_location, + sensor=reactive_sensor, + attributes=REACTIVE_SENSORS[reactive_sensor], + ) + ) + # Add solar sensors if service_location.has_solar_production: for sensor in SOLAR_SENSORS: @@ -180,17 +193,18 @@ async def async_setup_entry(hass, config_entry, async_add_entities): ) ) - # Add phase- and line voltages - for sensor_name, sensor in VOLTAGE_SENSORS.items(): - if service_location.phase_type in sensor[5]: - entities.append( - SmappeeSensor( - smappee_base=smappee_base, - service_location=service_location, - sensor=sensor_name, - attributes=sensor, + # Add phase- and line voltages if available + if service_location.has_voltage_values: + for sensor_name, sensor in VOLTAGE_SENSORS.items(): + if service_location.phase_type in sensor[5]: + entities.append( + SmappeeSensor( + smappee_base=smappee_base, + service_location=service_location, + sensor=sensor_name, + attributes=sensor, + ) ) - ) # Add Gas and Water sensors for sensor_id, sensor in service_location.sensors.items(): diff --git a/requirements_all.txt b/requirements_all.txt index a57204caed7..1b7169fe4c4 100644 --- a/requirements_all.txt +++ b/requirements_all.txt @@ -1620,7 +1620,7 @@ pysignalclirestapi==0.3.4 pysma==0.3.5 # homeassistant.components.smappee -pysmappee==0.1.2 +pysmappee==0.1.4 # homeassistant.components.smartthings pysmartapp==0.3.2 diff --git a/requirements_test_all.txt b/requirements_test_all.txt index 6422aaffbd0..8bb409ba1a1 100644 --- a/requirements_test_all.txt +++ b/requirements_test_all.txt @@ -727,7 +727,7 @@ pysignalclirestapi==0.3.4 pysma==0.3.5 # homeassistant.components.smappee -pysmappee==0.1.2 +pysmappee==0.1.4 # homeassistant.components.smartthings pysmartapp==0.3.2