Add vicare heat pump sensors (#41413)

pull/45696/head
Martin 2021-01-29 08:55:51 +01:00 committed by GitHub
parent 8b3156ea82
commit c7db2c35b7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 84 additions and 4 deletions

View File

@ -23,8 +23,16 @@ _LOGGER = logging.getLogger(__name__)
CONF_GETTER = "getter"
SENSOR_CIRCULATION_PUMP_ACTIVE = "circulationpump_active"
# gas sensors
SENSOR_BURNER_ACTIVE = "burner_active"
# heatpump sensors
SENSOR_COMPRESSOR_ACTIVE = "compressor_active"
SENSOR_HEATINGROD_OVERALL = "heatingrod_overall"
SENSOR_HEATINGROD_LEVEL1 = "heatingrod_level1"
SENSOR_HEATINGROD_LEVEL2 = "heatingrod_level2"
SENSOR_HEATINGROD_LEVEL3 = "heatingrod_level3"
SENSOR_TYPES = {
SENSOR_CIRCULATION_PUMP_ACTIVE: {
@ -44,13 +52,39 @@ SENSOR_TYPES = {
CONF_DEVICE_CLASS: DEVICE_CLASS_POWER,
CONF_GETTER: lambda api: api.getCompressorActive(),
},
SENSOR_HEATINGROD_OVERALL: {
CONF_NAME: "Heating rod overall",
CONF_DEVICE_CLASS: DEVICE_CLASS_POWER,
CONF_GETTER: lambda api: api.getHeatingRodStatusOverall(),
},
SENSOR_HEATINGROD_LEVEL1: {
CONF_NAME: "Heating rod level 1",
CONF_DEVICE_CLASS: DEVICE_CLASS_POWER,
CONF_GETTER: lambda api: api.getHeatingRodStatusLevel1(),
},
SENSOR_HEATINGROD_LEVEL2: {
CONF_NAME: "Heating rod level 2",
CONF_DEVICE_CLASS: DEVICE_CLASS_POWER,
CONF_GETTER: lambda api: api.getHeatingRodStatusLevel2(),
},
SENSOR_HEATINGROD_LEVEL3: {
CONF_NAME: "Heating rod level 3",
CONF_DEVICE_CLASS: DEVICE_CLASS_POWER,
CONF_GETTER: lambda api: api.getHeatingRodStatusLevel3(),
},
}
SENSORS_GENERIC = [SENSOR_CIRCULATION_PUMP_ACTIVE]
SENSORS_BY_HEATINGTYPE = {
HeatingType.gas: [SENSOR_BURNER_ACTIVE],
HeatingType.heatpump: [SENSOR_COMPRESSOR_ACTIVE],
HeatingType.heatpump: [
SENSOR_COMPRESSOR_ACTIVE,
SENSOR_HEATINGROD_OVERALL,
SENSOR_HEATINGROD_LEVEL1,
SENSOR_HEATINGROD_LEVEL2,
SENSOR_HEATINGROD_LEVEL3,
],
}

View File

@ -12,6 +12,7 @@ from homeassistant.const import (
ENERGY_KILO_WATT_HOUR,
PERCENTAGE,
TEMP_CELSIUS,
TIME_HOURS,
)
from homeassistant.helpers.entity import Entity
@ -52,6 +53,11 @@ SENSOR_GAS_CONSUMPTION_THIS_YEAR = "gas_consumption_heating_this_year"
# heatpump sensors
SENSOR_COMPRESSOR_STARTS = "compressor_starts"
SENSOR_COMPRESSOR_HOURS = "compressor_hours"
SENSOR_COMPRESSOR_HOURS_LOADCLASS1 = "compressor_hours_loadclass1"
SENSOR_COMPRESSOR_HOURS_LOADCLASS2 = "compressor_hours_loadclass2"
SENSOR_COMPRESSOR_HOURS_LOADCLASS3 = "compressor_hours_loadclass3"
SENSOR_COMPRESSOR_HOURS_LOADCLASS4 = "compressor_hours_loadclass4"
SENSOR_COMPRESSOR_HOURS_LOADCLASS5 = "compressor_hours_loadclass5"
SENSOR_TYPES = {
SENSOR_OUTSIDE_TEMPERATURE: {
@ -149,7 +155,7 @@ SENSOR_TYPES = {
SENSOR_BURNER_HOURS: {
CONF_NAME: "Burner Hours",
CONF_ICON: "mdi:counter",
CONF_UNIT_OF_MEASUREMENT: None,
CONF_UNIT_OF_MEASUREMENT: TIME_HOURS,
CONF_GETTER: lambda api: api.getBurnerHours(),
CONF_DEVICE_CLASS: None,
},
@ -164,10 +170,45 @@ SENSOR_TYPES = {
SENSOR_COMPRESSOR_HOURS: {
CONF_NAME: "Compressor Hours",
CONF_ICON: "mdi:counter",
CONF_UNIT_OF_MEASUREMENT: None,
CONF_UNIT_OF_MEASUREMENT: TIME_HOURS,
CONF_GETTER: lambda api: api.getCompressorHours(),
CONF_DEVICE_CLASS: None,
},
SENSOR_COMPRESSOR_HOURS_LOADCLASS1: {
CONF_NAME: "Compressor Hours Load Class 1",
CONF_ICON: "mdi:counter",
CONF_UNIT_OF_MEASUREMENT: TIME_HOURS,
CONF_GETTER: lambda api: api.getCompressorHoursLoadClass1(),
CONF_DEVICE_CLASS: None,
},
SENSOR_COMPRESSOR_HOURS_LOADCLASS2: {
CONF_NAME: "Compressor Hours Load Class 2",
CONF_ICON: "mdi:counter",
CONF_UNIT_OF_MEASUREMENT: TIME_HOURS,
CONF_GETTER: lambda api: api.getCompressorHoursLoadClass2(),
CONF_DEVICE_CLASS: None,
},
SENSOR_COMPRESSOR_HOURS_LOADCLASS3: {
CONF_NAME: "Compressor Hours Load Class 3",
CONF_ICON: "mdi:counter",
CONF_UNIT_OF_MEASUREMENT: TIME_HOURS,
CONF_GETTER: lambda api: api.getCompressorHoursLoadClass3(),
CONF_DEVICE_CLASS: None,
},
SENSOR_COMPRESSOR_HOURS_LOADCLASS4: {
CONF_NAME: "Compressor Hours Load Class 4",
CONF_ICON: "mdi:counter",
CONF_UNIT_OF_MEASUREMENT: TIME_HOURS,
CONF_GETTER: lambda api: api.getCompressorHoursLoadClass4(),
CONF_DEVICE_CLASS: None,
},
SENSOR_COMPRESSOR_HOURS_LOADCLASS5: {
CONF_NAME: "Compressor Hours Load Class 5",
CONF_ICON: "mdi:counter",
CONF_UNIT_OF_MEASUREMENT: TIME_HOURS,
CONF_GETTER: lambda api: api.getCompressorHoursLoadClass5(),
CONF_DEVICE_CLASS: None,
},
SENSOR_RETURN_TEMPERATURE: {
CONF_NAME: "Return Temperature",
CONF_ICON: None,
@ -195,8 +236,13 @@ SENSORS_BY_HEATINGTYPE = {
SENSOR_GAS_CONSUMPTION_THIS_YEAR,
],
HeatingType.heatpump: [
SENSOR_COMPRESSOR_HOURS,
SENSOR_COMPRESSOR_STARTS,
SENSOR_COMPRESSOR_HOURS,
SENSOR_COMPRESSOR_HOURS_LOADCLASS1,
SENSOR_COMPRESSOR_HOURS_LOADCLASS2,
SENSOR_COMPRESSOR_HOURS_LOADCLASS3,
SENSOR_COMPRESSOR_HOURS_LOADCLASS4,
SENSOR_COMPRESSOR_HOURS_LOADCLASS5,
SENSOR_RETURN_TEMPERATURE,
],
}