Update Smappee integration with proper solar, voltage and reactive entities (#37407)

pull/37667/head
bsmappee 2020-07-08 22:45:01 +02:00 committed by GitHub
parent d60c52bbc7
commit 99c815bcbd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 34 additions and 20 deletions

View File

@ -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"

View File

@ -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():

View File

@ -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

View File

@ -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