Skip to content

Commit

Permalink
revert assignment only if it increases
Browse files Browse the repository at this point in the history
  • Loading branch information
pail23 committed May 30, 2024
1 parent a12c955 commit 91ca06b
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions custom_components/stiebel_eltron_isg/wpm_coordinator.py
Original file line number Diff line number Diff line change
Expand Up @@ -690,18 +690,18 @@ def read_modbus_energy(self) -> dict:
decoder = BinaryPayloadDecoder.fromRegisters(
inverter_data.registers, byteorder=Endian.BIG
)
produced_heating_today = self.assign_if_increased(decoder.decode_16bit_uint(), PRODUCED_HEATING_TODAY)
produced_heating_today = decoder.decode_16bit_uint()
produced_heating_total_low = decoder.decode_16bit_uint()
produced_heating_total_high = decoder.decode_16bit_uint()
produced_water_today = self.assign_if_increased(decoder.decode_16bit_uint(), PRODUCED_WATER_HEATING_TODAY)
produced_water_today = decoder.decode_16bit_uint()
produced_water_total_low = decoder.decode_16bit_uint()
produced_water_total_high = decoder.decode_16bit_uint()
decoder.skip_bytes(8) # Skip NHZ
consumed_heating_today = self.assign_if_increased(decoder.decode_16bit_uint(), CONSUMED_HEATING_TODAY)
consumed_heating_today = decoder.decode_16bit_uint()

consumed_heating_total_low = decoder.decode_16bit_uint()
consumed_heating_total_high = decoder.decode_16bit_uint()
consumed_water_today = self.assign_if_increased(decoder.decode_16bit_uint(), CONSUMED_WATER_HEATING_TODAY)
consumed_water_today = decoder.decode_16bit_uint()
consumed_water_total_low = decoder.decode_16bit_uint()
consumed_water_total_high = decoder.decode_16bit_uint()

Expand Down Expand Up @@ -731,9 +731,8 @@ def read_modbus_energy(self) -> dict:
)

result[CONSUMED_WATER_HEATING_TODAY] = consumed_water_today
result[CONSUMED_WATER_HEATING_TOTAL] = self.assign_if_increased(
consumed_water_total_high * 1000 + consumed_water_total_low, CONSUMED_WATER_HEATING_TOTAL
)
result[CONSUMED_WATER_HEATING_TOTAL] = consumed_water_total_high * 1000 + consumed_water_total_low, CONSUMED_WATER_HEATING_TOTAL

result[CONSUMED_WATER_HEATING] = self.assign_if_increased(
result[CONSUMED_WATER_HEATING_TOTAL]
+ result[CONSUMED_WATER_HEATING_TODAY], CONSUMED_WATER_HEATING
Expand Down

0 comments on commit 91ca06b

Please sign in to comment.