From 89bde26db47723f8eeb0b2ef77b2728ddb3ac2e0 Mon Sep 17 00:00:00 2001 From: smarthomejoey <156961539+smarthomejoey@users.noreply.github.com> Date: Fri, 20 Dec 2024 20:58:41 +0100 Subject: [PATCH] Added solar values for LWZ --- custom_components/stiebel_eltron_isg/const.py | 6 ++ .../stiebel_eltron_isg/lwz_coordinator.py | 56 ++++++++++++++++++- .../stiebel_eltron_isg/sensor.py | 29 +++++++++- 3 files changed, 87 insertions(+), 4 deletions(-) diff --git a/custom_components/stiebel_eltron_isg/const.py b/custom_components/stiebel_eltron_isg/const.py index 7324c40..11cc937 100644 --- a/custom_components/stiebel_eltron_isg/const.py +++ b/custom_components/stiebel_eltron_isg/const.py @@ -54,6 +54,7 @@ TARGET_TEMPERATURE_BUFFER = "target_temperature_buffer" ACTUAL_TEMPERATURE_WATER = "actual_temperature_water" TARGET_TEMPERATURE_WATER = "target_temperature_water" +SOLAR_COLLECTOR_TEMPERATURE = "solar_collector_temperature" SOURCE_TEMPERATURE = "source_temperature" SOURCE_PRESSURE = "source_pressure" FLOW_TEMPERATURE = "flow_temperature" @@ -102,6 +103,11 @@ PREVIOUS_PRODUCED_WATER_HEATING_TOTAL = "previous_produced_water_heating_total" PRODUCED_WATER_HEATING = "produced_water_heating" +PRODUCED_SOLAR_HEATING_TODAY = "produced_solar_heating_today" +PRODUCED_SOLAR_HEATING_TOTAL = "produced_solar_heating_total" +PRODUCED_SOLAR_WATER_HEATING_TODAY = "produced_solar_water_heating_today" +PRODUCED_SOLAR_WATER_HEATING_TOTAL = "produced_solar_water_heating_total" + CONSUMED_HEATING_TODAY = "consumed_heating_today" CONSUMED_HEATING_TOTAL = "consumed_heating_total" PREVIOUS_CONSUMED_HEATING_TOTAL = "previous_consumed_heating_total" diff --git a/custom_components/stiebel_eltron_isg/lwz_coordinator.py b/custom_components/stiebel_eltron_isg/lwz_coordinator.py index 504208d..2442f8d 100644 --- a/custom_components/stiebel_eltron_isg/lwz_coordinator.py +++ b/custom_components/stiebel_eltron_isg/lwz_coordinator.py @@ -78,6 +78,10 @@ PRODUCED_WATER_HEATING, PRODUCED_WATER_HEATING_TODAY, PRODUCED_WATER_HEATING_TOTAL, + PRODUCED_SOLAR_HEATING_TODAY, + PRODUCED_SOLAR_HEATING_TOTAL, + PRODUCED_SOLAR_WATER_HEATING_TODAY, + PRODUCED_SOLAR_WATER_HEATING_TOTAL, PUMP_ON_HK1, RETURN_TEMPERATURE, SERVICE, @@ -92,6 +96,7 @@ TARGET_TEMPERATURE_HK1, TARGET_TEMPERATURE_HK2, TARGET_TEMPERATURE_WATER, + SOLAR_COLLECTOR_TEMPERATURE, VENTILATION, VENTILATION_AIR_ACTUAL_FAN_SPEED, VENTILATION_AIR_TARGET_FLOW_RATE, @@ -237,8 +242,12 @@ async def read_modbus_system_values(self) -> dict: result[DEWPOINT_TEMPERATURE_HK2] = get_isg_scaled_value( decoder.decode_16bit_int() ) - # skip 27-30 - decoder.skip_bytes(8) + # 27 + result[SOLAR_COLLECTOR_TEMPERATURE] = get_isg_scaled_value( + decoder.decode_16bit_int() + ) + # skip 28-30 + decoder.skip_bytes(6) # 31 compressor_starts_high = decoder.decode_16bit_uint() decoder.skip_bytes(4) @@ -325,17 +334,23 @@ async def read_modbus_energy(self) -> dict: inverter_data.registers, byteorder=Endian.BIG, ) + # 3001 produced_heating_today = self.assign_if_increased( decoder.decode_16bit_uint(), PRODUCED_HEATING_TODAY, ) + # 3002 produced_heating_total_low = decoder.decode_16bit_uint() + # 3003 produced_heating_total_high = decoder.decode_16bit_uint() + # 3004 produced_water_today = self.assign_if_increased( decoder.decode_16bit_uint(), PRODUCED_WATER_HEATING_TODAY, ) + # 3005 produced_water_total_low = decoder.decode_16bit_uint() + # 3006 produced_water_total_high = decoder.decode_16bit_uint() result[PRODUCED_HEATING_TODAY] = produced_heating_today @@ -356,8 +371,43 @@ async def read_modbus_energy(self) -> dict: + result[PRODUCED_WATER_HEATING_TODAY], PRODUCED_WATER_HEATING, ) + # 3007 - 3010 + decoder.skip_bytes(8) + # 3011 - 3013 + decoder.skip_bytes(6) + # 3014 + produced_solar_heating_today = self.assign_if_increased( + decoder.decode_16bit_uint(), + PRODUCED_SOLAR_HEATING_TODAY, + ) + result[PRODUCED_SOLAR_HEATING_TODAY] = produced_solar_heating_today - decoder.skip_bytes(30) + # 3015 + produced_solar_heating_total_low = decoder.decode_16bit_uint() + # 3016 + produced_solar_heating_total_high = decoder.decode_16bit_uint() + result[PRODUCED_SOLAR_HEATING_TOTAL] = ( + produced_solar_heating_total_high * 1000 + produced_solar_heating_total_low + ) + + # 3017 + produced_solar_water_heating_today = self.assign_if_increased( + decoder.decode_16bit_uint(), + PRODUCED_SOLAR_WATER_HEATING_TODAY, + ) + result[PRODUCED_SOLAR_WATER_HEATING_TODAY] = produced_solar_water_heating_today + + # 3018 + produced_solar_water_heating_total_low = decoder.decode_16bit_uint() + # 3019 + produced_solar_water_heating_total_high = decoder.decode_16bit_uint() + result[PRODUCED_SOLAR_WATER_HEATING_TOTAL] = ( + produced_solar_water_heating_total_high * 1000 + produced_solar_water_heating_total_low + ) + + # 3020 - 3021 + decoder.skip_bytes(4) + # 3022 consumed_heating_today = self.assign_if_increased( decoder.decode_16bit_uint(), CONSUMED_HEATING_TODAY, diff --git a/custom_components/stiebel_eltron_isg/sensor.py b/custom_components/stiebel_eltron_isg/sensor.py index 487b271..1b67b86 100644 --- a/custom_components/stiebel_eltron_isg/sensor.py +++ b/custom_components/stiebel_eltron_isg/sensor.py @@ -84,6 +84,10 @@ PRODUCED_WATER_HEATING, PRODUCED_WATER_HEATING_TODAY, PRODUCED_WATER_HEATING_TOTAL, + PRODUCED_SOLAR_HEATING_TODAY, + PRODUCED_SOLAR_HEATING_TOTAL, + PRODUCED_SOLAR_WATER_HEATING_TODAY, + PRODUCED_SOLAR_WATER_HEATING_TOTAL, RETURN_TEMPERATURE, RETURN_TEMPERATURE_WP1, RETURN_TEMPERATURE_WP2, @@ -102,6 +106,7 @@ TARGET_TEMPERATURE_HK2, TARGET_TEMPERATURE_HK3, TARGET_TEMPERATURE_WATER, + SOLAR_COLLECTOR_TEMPERATURE, VENTILATION_AIR_ACTUAL_FAN_SPEED, VENTILATION_AIR_TARGET_FLOW_RATE, VOLUME_STREAM, @@ -307,6 +312,10 @@ def create_volume_stream_entity_description(name, key): "Target Temperature Water", TARGET_TEMPERATURE_WATER, ), + create_temperature_entity_description( + "Solar Collector Temperature", + SOLAR_COLLECTOR_TEMPERATURE, + ), create_temperature_entity_description("Source Temperature", SOURCE_TEMPERATURE), create_pressure_entity_description("Source Pressure", SOURCE_PRESSURE), create_temperature_entity_description("Hot Gas Temperature", HOT_GAS_TEMPERATURE), @@ -368,7 +377,17 @@ def create_volume_stream_entity_description(name, key): "Produced Water Heating Total", PRODUCED_WATER_HEATING_TOTAL, ), - create_energy_entity_description("Produced Water Heating", PRODUCED_WATER_HEATING), + create_energy_entity_description( + "Produced Water Heating", + PRODUCED_WATER_HEATING), + create_energy_entity_description( + "Produced Solar Heating Total", + PRODUCED_SOLAR_HEATING_TOTAL, + ), + create_energy_entity_description( + "Produced Solar Water Heating Total", + PRODUCED_SOLAR_WATER_HEATING_TOTAL, + ), create_energy_entity_description( "Consumed Heating Total", CONSUMED_HEATING_TOTAL, @@ -396,6 +415,14 @@ def create_volume_stream_entity_description(name, key): "Produced Water Heating Today", PRODUCED_WATER_HEATING_TODAY, ), + create_daily_energy_entity_description( + "Produced Solar Heating Today", + PRODUCED_SOLAR_HEATING_TODAY, + ), + create_daily_energy_entity_description( + "Produced Solar Water Heating Today", + PRODUCED_SOLAR_WATER_HEATING_TODAY, + ), create_daily_energy_entity_description( "Consumed Heating Today", CONSUMED_HEATING_TODAY,