Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added additional sensors #289

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
83 changes: 79 additions & 4 deletions custom_components/luxtronik/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,17 +226,17 @@ def _up(ident: str, new_id: SK, platform: P = P.SENSOR) -> None:
)
_up(
"heating_circuit_curve1_temperature",
SK.HEATING_CIRCUIT_CURVE1_TEMPERATURE,
SK.HEATING_CURVE_END_TEMPERATURE,
P.NUMBER,
)
_up(
"heating_circuit_curve2_temperature",
SK.HEATING_CIRCUIT_CURVE2_TEMPERATURE,
SK.HEATING_CURVE_PARALLEL_SHIFT_TEMPERATURE,
P.NUMBER,
)
_up(
"heating_circuit_curve_night_temperature",
SK.HEATING_CIRCUIT_CURVE_NIGHT_TEMPERATURE,
SK.HEATING_CURVE_NIGHT_TEMPERATURE,
P.NUMBER,
)
_up(
Expand Down Expand Up @@ -289,7 +289,82 @@ def _up(ident: str, new_id: SK, platform: P = P.SENSOR) -> None:
_up("cooling_stop_delay_hours", SK.COOLING_STOP_DELAY_HOURS, P.NUMBER)

new_data = {**config_entry.data}
config_entry.version = 7
hass.config_entries.async_update_entry(config_entry, data=new_data)

if config_entry.version == 7:
# harmonize naming
_up(
"flow_in_circuit2_temperature",
SK.FLOW_IN_CIRCUIT1_TEMPERATURE,
P.NUMBER,
)
_up(
"flow_in_circuit3_temperature",
SK.FLOW_IN_CIRCUIT2_TEMPERATURE,
P.NUMBER,
)
_up(
"flow_in_circuit2_target_temperature",
SK.FLOW_IN_CIRCUIT1_TARGET_TEMPERATURE,
P.NUMBER,
)
_up(
"flow_in_circuit3_target_temperature",
SK.FLOW_IN_CIRCUIT2_TARGET_TEMPERATURE,
P.NUMBER,
)

# main circuit
_up(
"heating_circuit_curve1_temperature",
SK.HEATING_CURVE_END_TEMPERATURE,
P.NUMBER,
)
_up(
"heating_circuit_curve2_temperature",
SK.HEATING_CURVE_PARALLEL_SHIFT_TEMPERATURE,
P.NUMBER,
)
_up(
"heating_circuit_curve_night_temperature",
SK.HEATING_CURVE_NIGHT_TEMPERATURE,
P.NUMBER,
)

# circuit 1
_up(
"heating_circuit2_curve1_temperature",
SK.HEATING_CURVE_CIRCUIT1_END_TEMPERATURE,
P.NUMBER,
)
_up(
"heating_circuit2_curve2_temperature",
SK.HEATING_CURVE_CIRCUIT1_PARALLEL_SHIFT_TEMPERATURE,
P.NUMBER,
)
_up(
"heating_circuit2_curve_night_temperature",
SK.HEATING_CURVE_CIRCUIT1_NIGHT_TEMPERATURE,
P.NUMBER,
)
# circuit 3
_up(
"heating_circuit3_curve1_temperature",
SK.HEATING_CURVE_CIRCUIT3_END_TEMPERATURE,
P.NUMBER,
)
_up(
"heating_circuit3_curve2_temperature",
SK.HEATING_CURVE_CIRCUIT3_PARALLEL_SHIFT_TEMPERATURE,
P.NUMBER,
)
_up(
"heating_circuit3_curve_night_temperature",
SK.HEATING_CURVE_CIRCUIT3_NIGHT_TEMPERATURE,
P.NUMBER,
)

new_data = {**config_entry.data}
hass.config_entries.async_update_entry(config_entry, data=new_data)

LOGGER.info("Migration to version %s successful", config_entry.version)
Expand Down
1 change: 0 additions & 1 deletion custom_components/luxtronik/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
from typing import Any
from enum import StrEnum

from homeassistant.components.sensor import RestoreSensor
from homeassistant.components.water_heater import STATE_HEAT_PUMP
from homeassistant.const import STATE_OFF, UnitOfTemperature, UnitOfTime
from homeassistant.core import callback
Expand Down
4 changes: 2 additions & 2 deletions custom_components/luxtronik/climate.py
Original file line number Diff line number Diff line change
Expand Up @@ -317,10 +317,10 @@ async def async_set_temperature(self, **kwargs: Any) -> None:

async def async_turn_off(self) -> None:
await self.async_set_hvac_mode(HVACMode.OFF)

async def async_turn_on(self) -> None:
await self.async_set_hvac_mode(HVACMode[self.entity_description.hvac_mode_mapping[LuxMode.automatic.value].upper()])

async def async_set_hvac_mode(self, hvac_mode: HVACMode) -> None:
"""Set new target hvac mode."""
self._attr_hvac_mode = hvac_mode
Expand Down
2 changes: 1 addition & 1 deletion custom_components/luxtronik/config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ async def _async_has_devices(hass: HomeAssistant) -> bool:
class LuxtronikFlowHandler(config_entries.ConfigFlow, domain=DOMAIN):
"""Handle a Luxtronik heatpump controller config flow."""

VERSION = 7
VERSION = 8
_hassio_discovery = None
_discovery_host = None
_discovery_port = None
Expand Down
102 changes: 70 additions & 32 deletions custom_components/luxtronik/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -275,21 +275,42 @@ class LuxParameter(StrEnum):
P0002_DHW_TARGET_TEMPERATURE: Final = "parameters.ID_Einst_BWS_akt"
P0003_MODE_HEATING: Final = "parameters.ID_Ba_Hz_akt"
P0004_MODE_DHW: Final = "parameters.ID_Ba_Bw_akt"
P0011_HEATING_CIRCUIT_CURVE1_TEMPERATURE: Final = "parameters.ID_Einst_HzHwHKE_akt"
P0012_HEATING_CIRCUIT_CURVE2_TEMPERATURE: Final = "parameters.ID_Einst_HzHKRANH_akt"
P0013_HEATING_CIRCUIT_CURVE_NIGHT_TEMPERATURE: Final = (
# luxtronik*_heating_curve*
P0011_HEATING_CURVE_END_TEMPERATURE: Final = "parameters.ID_Einst_HzHwHKE_akt"
P0012_HEATING_CURVE_PARALLEL_SHIFT_TEMPERATURE: Final = "parameters.ID_Einst_HzHKRANH_akt"
P0013_HEATING_CURVE_NIGHT_TEMPERATURE: Final = (
"parameters.ID_Einst_HzHKRABS_akt"
)
# luxtronik*_heating_circuit2_curve*
P0014_HEATING_CIRCUIT2_CURVE1_TEMPERATURE: Final = (
# luxtronik*_heating_curve_circuit1*
P0014_HEATING_CURVE_CIRCUIT1_END_TEMPERATURE: Final = (
"parameters.ID_Einst_HzMK1E_akt" # 260
)
P0015_HEATING_CIRCUIT2_CURVE2_TEMPERATURE: Final = (
P0015_HEATING_CURVE_CIRCUIT1_PARALLEL_SHIFT_TEMPERATURE: Final = (
"parameters.ID_Einst_HzMK1ANH_akt" # 290
)
P0016_HEATING_CIRCUIT2_CURVE_NIGHT_TEMPERATURE: Final = (
P0016_HEATING_CURVE_CIRCUIT1_NIGHT_TEMPERATURE: Final = (
"parameters.ID_Einst_HzMK1ABS_akt" # 0
)
# luxtronik*_heating_curve_circuit2*
P0017_HEATING_CURVE_CIRCUIT2_END_TEMPERATURE: Final = (
"parameters.ID_Einst_HzMK2E_akt" # 260
)
P0018_HEATING_CURVE_CIRCUIT2_PARALLEL_SHIFT_TEMPERATURE: Final = (
"parameters.ID_Einst_HzMK2ANH_akt" # 290
)
P0019_HEATING_CURVE_CIRCUIT2_NIGHT_TEMPERATURE: Final = (
"parameters.ID_Einst_HzMK2ABS_akt" # 0
)
# luxtronik*_heating_curve_circuit3*
P0020_HEATING_CURVE_CIRCUIT3_END_TEMPERATURE: Final = (
"parameters.ID_Einst_HzMK3E_akt" # 270
)
P0021_HEATING_CURVE_CIRCUIT3_PARALLEL_SHIFT_TEMPERATURE: Final = (
"parameters.ID_Einst_HzMK3ANH_akt" # 290
)
P0022_HEATING_CURVE_CIRCUIT3_NIGHT_TEMPERATURE: Final = (
"parameters.ID_Einst_HzMK3ABS_akt" # 0
)
# P0036_SECOND_HEAT_GENERATOR: Final = "parameters.ID_Einst_ZWE1Art_akt" # = 1 --> Heating and domestic water - Is second heat generator activated 1=electrical heater
P0042_MIXING_CIRCUIT1_TYPE: Final = "parameters.ID_Einst_MK1Typ_akt"
P0047_DHW_THERMAL_DESINFECTION_TARGET: Final = "parameters.ID_Einst_LGST_akt"
Expand Down Expand Up @@ -327,16 +348,6 @@ class LuxParameter(StrEnum):
P0700_HEATING_THRESHOLD_TEMPERATURE: Final = "parameters.ID_Einst_Heizgrenze_Temp"
P0716_0720_SWITCHOFF_REASON: Final = "parameters.ID_Switchoff_file_{ID}_0" # e.g. ID_Switchoff_file_0_0 - ID_Switchoff_file_4_0
P0721_0725_SWITCHOFF_TIMESTAMP: Final = "parameters.ID_Switchoff_file_{ID}_1" # e.g. ID_Switchoff_file_0_1 - ID_Switchoff_file_4_1
# luxtronik*_heating_circuit3_curve*
P0774_HEATING_CIRCUIT3_CURVE1_TEMPERATURE: Final = (
"parameters.ID_Einst_HzMK3E_akt" # 270
)
P0775_HEATING_CIRCUIT3_CURVE2_TEMPERATURE: Final = (
"parameters.ID_Einst_HzMK3ANH_akt" # 290
)
P0776_HEATING_CIRCUIT3_CURVE_NIGHT_TEMPERATURE: Final = (
"parameters.ID_Einst_HzMK3ABS_akt" # 0
)
P0850_COOLING_START_DELAY_HOURS: Final = "parameters.ID_Einst_Kuhl_Zeit_Ein_akt"
P0851_COOLING_STOP_DELAY_HOURS: Final = "parameters.ID_Einst_Kuhl_Zeit_Aus_akt"
P0860_REMOTE_MAINTENANCE: Final = "parameters.ID_Einst_Fernwartung_akt"
Expand Down Expand Up @@ -419,7 +430,13 @@ class LuxCalculation(StrEnum):
C0015_OUTDOOR_TEMPERATURE: Final = "calculations.ID_WEB_Temperatur_TA"
C0016_OUTDOOR_TEMPERATURE_AVERAGE: Final = "calculations.ID_WEB_Mitteltemperatur"
C0017_DHW_TEMPERATURE: Final = "calculations.ID_WEB_Temperatur_TBW"
C0020_HEAT_SOURCE_OUTPUT_TEMPERATURE: Final = "calculations.ID_WEB_Temperatur_TWA"
C0018_FLOW_IN_CIRCUIT1_TEMPERATURE: Final = "calculations.ID_WEB_Temperatur_TFB1"
C0019_FLOW_IN_CIRCUIT2_TEMPERATURE: Final = "calculations.ID_WEB_Temperatur_TFB2"
C0020_FLOW_IN_CIRCUIT3_TEMPERATURE: Final = "calculations.ID_WEB_Temperatur_TFB3"
C0021_FLOW_IN_CIRCUIT1_TARGET_TEMPERATURE: Final = "calculations.ID_WEB_Sollwert_TVL_MK1"
C0022_FLOW_IN_CIRCUIT2_TARGET_TEMPERATURE: Final = "calculations.ID_WEB_Sollwert_TVL_MK2"
C0023_FLOW_IN_CIRCUIT3_TARGET_TEMPERATURE: Final = "calculations.ID_WEB_Sollwert_TVL_MK3"
C0024_HEAT_SOURCE_OUTPUT_TEMPERATURE: Final = "calculations.ID_WEB_Temperatur_TWA"
C0026_SOLAR_COLLECTOR_TEMPERATURE: Final = "calculations.ID_WEB_Temperatur_TSK"
C0027_SOLAR_BUFFER_TEMPERATURE: Final = "calculations.ID_WEB_Temperatur_TSS"
C0029_DEFROST_END_FLOW_OKAY: Final = "calculations.ID_WEB_ASDin"
Expand Down Expand Up @@ -449,6 +466,9 @@ class LuxCalculation(StrEnum):
C0060_ADDITIONAL_HEAT_GENERATOR_OPERATION_HOURS: Final = (
"calculations.ID_WEB_Zaehler_BetrZeitZWE1"
)
C0061_ADDITIONAL_HEAT_GENERATOR2_OPERATION_HOURS: Final = (
"calculations.ID_WEB_Zaehler_BetrZeitZWE2"
)
C0063_OPERATION_HOURS: Final = "calculations.ID_WEB_Zaehler_BetrZeitWP"
C0064_OPERATION_HOURS_HEATING: Final = "calculations.ID_WEB_Zaehler_BetrZeitHz"
C0065_DHW_OPERATION_HOURS: Final = "calculations.ID_WEB_Zaehler_BetrZeitBW"
Expand Down Expand Up @@ -527,7 +547,9 @@ class LuxVisibility(StrEnum):

UNSET: Final = "UNSET"
V0005_COOLING: Final = "visibilities.ID_Visi_Kuhlung"
V0007_MK1: Final = "visibilities.ID_Visi_MK1"
V0008_MK2: Final = "visibilities.ID_Visi_MK2"
V0009_MK3: Final = "visibilities.ID_Visi_MK3"
V0023_FLOW_IN_TEMPERATURE: Final = "visibilities.ID_Visi_Temp_Vorlauf"
V0024_FLOW_OUT_TEMPERATURE_EXTERNAL: Final = "visibilities.ID_Visi_Temp_Rucklauf"
V0027_HOT_GAS_TEMPERATURE: Final = "visibilities.ID_Visi_Temp_Heissgas"
Expand All @@ -551,11 +573,13 @@ class LuxVisibility(StrEnum):
V0086_ADDITIONAL_HEAT_GENERATOR_OPERATION_HOURS: Final = (
"visibilities.ID_Visi_Bst_BStdZWE1"
)
V0087_ADDITIONAL_HEAT_GENERATOR2_OPERATION_HOURS: Final = (
"visibilities.ID_Visi_Bst_BStdZWE2"
)
V0105_HEAT_SOURCE_INPUT_TEMPERATURE_MIN: Final = "visibilities.ID_Visi_EinstTemp_TWQmin"
V0121_EVU_LOCKED: Final = "visibilities.ID_Visi_SysEin_EVUSperre"
V0122_ROOM_THERMOSTAT: Final = "visibilities.ID_Visi_SysEin_Raumstation"
V0144_PUMP_OPTIMIZATION: Final = "visibilities.ID_Visi_SysEin_Pumpenoptim"
V0211_MK3: Final = "visibilities.ID_Visi_MK3"
V0239_EFFICIENCY_PUMP_NOMINAL: Final = (
"visibilities.ID_Visi_SysEin_EffizienzpumpeNom"
)
Expand Down Expand Up @@ -613,10 +637,13 @@ class SensorKey(StrEnum):
ADDITIONAL_HEAT_GENERATOR_OPERATION_HOURS = (
"additional_heat_generator_operation_hours"
)
ADDITIONAL_HEAT_GENERATOR2_OPERATION_HOURS = (
"additional_heat_generator2_operation_hours"
)
ADDITIONAL_HEAT_GENERATOR_AMOUNT_COUNTER = (
"additional_heat_generator_amount_counter"
)
SECOND_HEAT_GENERATOR_AMOUNT_COUNTER= "second_heat_generator_amount_counter"
SECOND_HEAT_GENERATOR_AMOUNT_COUNTER = "second_heat_generator_amount_counter"
ANALOG_OUT1 = "analog_out1"
ANALOG_OUT2 = "analog_out2"
CURRENT_HEAT_OUTPUT = "current_heat_output"
Expand All @@ -629,6 +656,12 @@ class SensorKey(StrEnum):
HEAT_SOURCE_OUTPUT_TEMPERATURE = "heat_source_output_temperature"
ERROR_REASON = "error_reason"
FLOW_IN_TEMPERATURE = "flow_in_temperature"
FLOW_IN_CIRCUIT1_TEMPERATURE = "flow_in_circuit1_temperature"
FLOW_IN_CIRCUIT2_TEMPERATURE = "flow_in_circuit2_temperature"
FLOW_IN_CIRCUIT3_TEMPERATURE = "flow_in_circuit3_temperature"
FLOW_IN_CIRCUIT1_TARGET_TEMPERATURE = "flow_in_circuit1_target_temperature"
FLOW_IN_CIRCUIT2_TARGET_TEMPERATURE = "flow_in_circuit2_target_temperature"
FLOW_IN_CIRCUIT3_TARGET_TEMPERATURE = "flow_in_circuit3_target_temperature"
FLOW_OUT_TEMPERATURE = "flow_out_temperature"
FLOW_OUT_TEMPERATURE_TARGET = "flow_out_temperature_target"
FLOW_OUT_TEMPERATURE_EXTERNAL = "flow_out_temperature_external"
Expand Down Expand Up @@ -662,18 +695,23 @@ class SensorKey(StrEnum):
PUMP_OPTIMIZATION_TIME = "pump_optimization_time"
HEATING_THRESHOLD_TEMPERATURE = "heating_threshold_temperature"
HEATING_MIN_FLOW_OUT_TEMPERATURE = "heating_min_flow_out_temperature"
HEATING_CIRCUIT_CURVE1_TEMPERATURE = "heating_circuit_curve1_temperature"
HEATING_CIRCUIT_CURVE2_TEMPERATURE = "heating_circuit_curve2_temperature"
HEATING_CIRCUIT_CURVE_NIGHT_TEMPERATURE = "heating_circuit_curve_night_temperature"
HEATING_CIRCUIT2_CURVE1_TEMPERATURE = "heating_circuit2_curve1_temperature"
HEATING_CIRCUIT2_CURVE2_TEMPERATURE = "heating_circuit2_curve2_temperature"
HEATING_CIRCUIT2_CURVE_NIGHT_TEMPERATURE = (
"heating_circuit2_curve_night_temperature"
)
HEATING_CIRCUIT3_CURVE1_TEMPERATURE = "heating_circuit3_curve1_temperature"
HEATING_CIRCUIT3_CURVE2_TEMPERATURE = "heating_circuit3_curve2_temperature"
HEATING_CIRCUIT3_CURVE_NIGHT_TEMPERATURE = (
"heating_circuit3_curve_night_temperature"
HEATING_CURVE_END_TEMPERATURE = "heating_curve_end_temperature"
HEATING_CURVE_PARALLEL_SHIFT_TEMPERATURE = "heating_curve_parallel_shift_temperature"
HEATING_CURVE_NIGHT_TEMPERATURE = "heating_curve_night_temperature"
HEATING_CURVE_CIRCUIT1_END_TEMPERATURE = "heating_curve_circuit1_end_temperature"
HEATING_CURVE_CIRCUIT1_PARALLEL_SHIFT_TEMPERATURE = "heating_curve_circuit1_parallel_shift_temperature"
HEATING_CURVE_CIRCUIT1_NIGHT_TEMPERATURE = (
"heating_curve_circuit1_night_temperature"
)
HEATING_CURVE_CIRCUIT2_END_TEMPERATURE = "heating_curve_circuit2_end_temperature"
HEATING_CURVE_CIRCUIT2_PARALLEL_SHIFT_TEMPERATURE = "heating_curve_circuit2_parallel_shift_temperature"
HEATING_CURVE_CIRCUIT2_NIGHT_TEMPERATURE = (
"heating_curve_circuit2_night_temperature"
)
HEATING_CURVE_CIRCUIT3_END_TEMPERATURE = "heating_curve_circuit3_end_temperature"
HEATING_CURVE_CIRCUIT3_PARALLEL_SHIFT_TEMPERATURE = "heating_curve_circuit3_parallel_shift_temperature"
HEATING_CURVE_CIRCUIT3_NIGHT_TEMPERATURE = (
"heating_curve_circuit3_night_temperature"
)
HEATING_NIGHT_LOWERING_TO_TEMPERATURE = "heating_night_lowering_to_temperature"
HEATING_HYSTERESIS = "heating_hysteresis"
Expand Down
4 changes: 2 additions & 2 deletions custom_components/luxtronik/coordinator.py
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ def entity_visible(self, description: LuxtronikEntityDescription) -> bool:
if description.visibility == LV.V0059A_DHW_CHARGING_PUMP:
return not self._detect_dhw_circulation_pump_present()
if description.visibility == LV.V0005_COOLING:
return self.detect_cooling_present()
return self.detect_cooling_present()
visibility_result = self.get_value(description.visibility)
if visibility_result is None:
LOGGER.warning("Could not load visibility %s", description.visibility)
Expand Down Expand Up @@ -369,7 +369,7 @@ def entity_active(self, description: LuxtronikEntityDescription) -> bool:
LV.V0039_SOLAR_BUFFER,
LV.V0250_SOLAR,
]:
return self._detect_solar_present()
return self._detect_solar_present()

if not self.device_key_active(description.device_key):
return False
Expand Down
3 changes: 0 additions & 3 deletions custom_components/luxtronik/lux_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@
import socket
import struct
import threading
import time

from async_timeout import timeout

from luxtronik.calculations import Calculations
from luxtronik.parameters import Parameters
Expand Down
1 change: 0 additions & 1 deletion custom_components/luxtronik/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,4 +199,3 @@ class LuxtronikUpdateEntityDescription(

device_class = UpdateDeviceClass.FIRMWARE
platform = Platform.UPDATE

Loading