Skip to content

Commit

Permalink
Fix for wrong conversion in Solvis Modbus api
Browse files Browse the repository at this point in the history
  • Loading branch information
LarsK1 committed Nov 26, 2024
1 parent bcaaeea commit 9cca67e
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
12 changes: 11 additions & 1 deletion custom_components/solvis_control/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class ModbusFieldConfig:
# sensor (0), select (1), number (2), switch (3)
input_type: int = 0
# Option to further process data
# 0: no processing, 1: version string split
# 0: no processing, 1: version string split, 2: special conversion
data_processing: int = 0
# Supported Version
# 0: SC2 & SC3, 1: SC3, 2: SC2
Expand Down Expand Up @@ -351,6 +351,16 @@ class ModbusFieldConfig:
unit="l/min",
device_class=None,
state_class="measurement",
supported_version=1,
),
ModbusFieldConfig( # Durchfluss Warmwasserzirkualation
name="domestic_water_flow",
address=33041,
unit="l/min",
device_class=None,
state_class="measurement",
supported_version=2,
data_processing=2,
),
ModbusFieldConfig( # HKR1 Betriebsart
name="hkr1_betriebsart",
Expand Down
4 changes: 4 additions & 0 deletions custom_components/solvis_control/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,10 @@ def _handle_coordinator_update(self) -> None:
else:
_LOGGER.warning("Couldn't process version string to Version.")
self._attr_native_value = response_data
case (
2
): # https://github.com/LarsK1/hass_solvis_control/issues/58#issuecomment-2496245943
self._attr_native_value = ((1 / (response_data / 60)) * 1000) / 42 * 60
case _:
self._attr_native_value = response_data # Update the sensor value
self.async_write_ha_state()

0 comments on commit 9cca67e

Please sign in to comment.