Skip to content

Commit

Permalink
Add sensors
Browse files Browse the repository at this point in the history
  • Loading branch information
BenPru committed Nov 10, 2021
1 parent 88a1da6 commit e1d5e6a
Show file tree
Hide file tree
Showing 6 changed files with 81 additions and 14 deletions.
31 changes: 26 additions & 5 deletions custom_components/luxtronik/climate.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,12 @@ async def async_setup_entry(

deviceInfoCooling = hass.data[f"{DOMAIN}_DeviceInfo_Cooling"]
if deviceInfoCooling is not None:
text_cooling = get_sensor_text(lang, 'cooling')
entities += [
LuxtronikCoolingThermostat(hass, luxtronik, deviceInfoCooling)
# TODO:
# LuxtronikCoolingThermostat(hass, luxtronik, deviceInfoCooling, name=text_cooling,
# control_mode_home_assistant=control_mode_home_assistant,
# current_temperature_sensor=LUX_SENSOR_DOMESTIC_WATER_CURRENT_TEMPERATURE, entity_category=None)
]

async_add_entities(entities)
Expand Down Expand Up @@ -369,10 +373,27 @@ class LuxtronikHeatingThermostat(LuxtronikThermostat):


class LuxtronikCoolingThermostat(LuxtronikThermostat):
_unique_id = 'cooling'
_name = "Kühlung"
_icon = 'far:snowflake'
_device_class = _unique_id
_attr_unique_id = 'cooling'
_attr_icon = 'mdi:snowflake'
_attr_device_class: Final = f"{DOMAIN}__{_attr_unique_id}"

_attr_target_temperature = 20.5
_attr_target_temperature_step = 0.5
_attr_min_temp = 18.0
_attr_max_temp = 30.0

# _heater_sensor: Final = LUX_SENSOR_MODE_HEATING

# temperature setpoint for cooling
# parameters.ID_Sollwert_KuCft2_akt
# 20.0

# parameters.ID_Einst_Kuhl_Zeit_Ein_akt
# start cooling after this timeout
# 12.0

# parameters.ID_Einst_Kuhl_Zeit_Aus_akt
# stop cooling after this timeout
# 12.0
_heater_sensor = 'calculations.ID_WEB_FreigabKuehl'
_heat_status = ['cooling']
2 changes: 2 additions & 0 deletions custom_components/luxtronik/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,8 @@ class LuxMode(Enum):
LUX_SENSOR_HEATING_THRESHOLD: Final = 'parameters.ID_Einst_Heizgrenze_Temp'
LUX_SENSOR_MODE_HEATING: Final = 'parameters.ID_Ba_Hz_akt'

LUX_SENSOR_COOLING_THRESHOLD: Final = 'parameters.ID_Einst_KuehlFreig_akt'

LUX_SENSOR_DOMESTIC_WATER_CURRENT_TEMPERATURE: Final = 'calculations.ID_WEB_Temperatur_TBW'
LUX_SENSOR_DOMESTIC_WATER_TARGET_TEMPERATURE: Final = 'parameters.ID_Einst_BWS_akt'
# LUX_SENSOR_DOMESTIC_WATER_TARGET_TEMPERATURE: Final = 'calculations.ID_WEB_Einst_BWS_akt'
Expand Down
9 changes: 8 additions & 1 deletion custom_components/luxtronik/number.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ async def async_setup_entry(
icon='mdi:plus-minus-variant', min_value=-5.0, max_value=5.0, step=0.5, mode=MODE_BOX),
LuxtronikNumber(hass, luxtronik, deviceInfoHeating, number_key=LUX_SENSOR_HEATING_THRESHOLD,
unique_id='heating_threshold_temperature', name=f"{text_heating_threshold}",
icon='mdi:thermometer-low', unit_of_measurement=TEMP_CELSIUS, min_value=5.0, max_value=12.0, step=0.5, mode=MODE_BOX)
icon='mdi:download-outline', unit_of_measurement=TEMP_CELSIUS, min_value=5.0, max_value=12.0, step=0.5, mode=MODE_BOX)
]

deviceInfoDomesticWater = hass.data[f"{DOMAIN}_DeviceInfo_Domestic_Water"]
Expand All @@ -74,6 +74,13 @@ async def async_setup_entry(
]

deviceInfoCooling = hass.data[f"{DOMAIN}_DeviceInfo_Cooling"]
if deviceInfoCooling is not None:
text_cooling_threshold_temperature = get_sensor_text(lang, 'cooling_threshold_temperature')
entities += [
LuxtronikNumber(hass, luxtronik, deviceInfoCooling, number_key=LUX_SENSOR_COOLING_THRESHOLD,
unique_id='cooling_threshold_temperature', name=f"{text_cooling_threshold_temperature}",
icon='mdi:upload-outline', unit_of_measurement=TEMP_CELSIUS, min_value=18.0, max_value=30.0, step=0.5, mode=MODE_BOX)
]

async_add_entities(entities)
# endregion Setup
Expand Down
7 changes: 5 additions & 2 deletions custom_components/luxtronik/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,8 @@ async def async_setup_entry(
lang = config_entry.options.get(CONF_LANGUAGE_SENSOR_NAMES)
text_time = get_sensor_text(lang, 'time')
text_temp = get_sensor_text(lang, 'temperature')
text_output = get_sensor_text(lang, 'output')
text_heat_source_output = get_sensor_text(lang, 'heat_source_output')
text_heat_source_input = get_sensor_text(lang, 'heat_source_input')
text_outdoor = get_sensor_text(lang, 'outdoor')
text_average = get_sensor_text(lang, 'average')
text_compressor_impulses = get_sensor_text(lang, 'compressor_impulses')
Expand All @@ -126,7 +127,9 @@ async def async_setup_entry(
LuxtronikSensor(hass, luxtronik, deviceInfo, 'calculations.ID_WEB_HauptMenuStatus_Zeile3',
'status_line_3', 'Status 3', 'mdi:numeric-3-circle', f"{DOMAIN}__status_line_3", None, None, entity_category=ENTITY_CATEGORY_DIAGNOSTIC),
LuxtronikSensor(hass, luxtronik, deviceInfo, 'calculations.ID_WEB_Temperatur_TWA',
'output_temperature', f"{text_output} {text_temp}", entity_category=None),
'heat_source_output_temperature', f"{text_heat_source_output} {text_temp}", entity_category=None),
LuxtronikSensor(hass, luxtronik, deviceInfo, 'calculations.ID_WEB_Temperatur_TWE',
'heat_source_input_temperature', f"{text_heat_source_input} {text_temp}", entity_category=None),
LuxtronikSensor(hass, luxtronik, deviceInfo, 'calculations.ID_WEB_Temperatur_TA',
'outdoor_temperature', f"{text_outdoor} {text_temp}", entity_category=None),
LuxtronikSensor(hass, luxtronik, deviceInfo, 'calculations.ID_WEB_Mitteltemperatur',
Expand Down
25 changes: 21 additions & 4 deletions custom_components/luxtronik/translations/texts.de.json
Original file line number Diff line number Diff line change
@@ -1,16 +1,33 @@
{
"average": "Mittel",
"outdoor": "Außen",
"output": "Ausgang",
"outdoor": "Aussen",
"heat_source_output": "Heizquelle Ausgang",
"heat_source_input": "Heizquelle Eingang",
"time": "Zeit",
"domestic_water": "Brauchwasser",
"cooling": "K\u00fchlung",
"target": "Soll",
"temperature": "Temperatur",
"buffer": "Puffer",
"collector": "Kollektor",
"flow_in": "Vorlauf",
"flow_out": "Rücklauf",
"flow_out": "R\u00fccklauf",
"correction": "Korrektur",
"heating": "Heizung",
"heatpump": "Wärmepumpe"
"heating_mode_auto": "Heizungsmodus Automatik",
"domestic_water_mode_auto": "Brauchwassermodus Automatik",
"heatpump": "W\u00e4rmepumpe",
"heating_threshold": "Heizgrenze",
"evu_unlocked": "Sperrzeit Freigabe",
"solar_pump": "Solar Pumpe",
"compressor_impulses": "Impulse Verdichter",
"operation_hours": "Betriebsstunden Gesamt",
"operation_hours_heating": "Betriebsstunden Heizung",
"operation_hours_domestic_water": "Betriebsstunden Brauchwasser",
"operation_hours_solar": "Betriebsstunden Solar",
"operation_hours_cooling": "Betriebsstunden K\u00fchlung",
"heat_amount_counter": "W\u00e4rmemenge Z\u00e4hler",
"heat_amount_heating": "W\u00e4rmemenge Heizung",
"heat_amount_domestic_water": "W\u00e4rmemenge Brauchwasser",
"approval_cooling": "K\u00fchlung Freigabe"
}
21 changes: 19 additions & 2 deletions custom_components/luxtronik/translations/texts.en.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
{
"average": "Average",
"outdoor": "Outdoor",
"output": "Output",
"heat_source_output": "Heat source output",
"heat_source_input": "Heat source input",
"time": "Time",
"domestic_water": "Domestic Water",
"cooling": "Cooling",
"target": "Target",
"temperature": "Temperature",
"buffer": "Buffer",
Expand All @@ -12,5 +14,20 @@
"flow_out": "Flow Out",
"correction": "Correction",
"heating": "Heating",
"heatpump": "Heatpump"
"heating_mode_auto": "Heating mode automatic",
"domestic_water_mode_auto": "Domestic Water mode automatic",
"heatpump": "Heatpump",
"heating_threshold": "Heating Threshold",
"evu_unlocked": "Locktime",
"solar_pump": "Solarpump",
"compressor_impulses": "Compressor Impulses",
"operation_hours": "Operation hours",
"operation_hours_heating": "Operation hours heating",
"operation_hours_domestic_water": "Operation hours domestic water",
"operation_hours_solar": "Operation hours solar",
"operation_hours_cooling": "Operation hours cooling",
"heat_amount_counter": "Heat amount counter",
"heat_amount_heating": "Heat amount heating",
"heat_amount_domestic_water": "Heat amount domestic water",
"approval_cooling": "Approval cooling"
}

0 comments on commit e1d5e6a

Please sign in to comment.