Skip to content

Commit

Permalink
Rollback validation check >= 0 to > 0 as it used to be. It's causing …
Browse files Browse the repository at this point in the history
…side effects. (#126 - #128)
  • Loading branch information
binsentsu committed Dec 8, 2022
1 parent 7fa199b commit 44a77a2
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions custom_components/solaredge_modbus/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -419,11 +419,11 @@ def read_modbus_data_meter(self, meter_prefix, start_address):
importedc = decoder.decode_32bit_uint()
energywsf = decoder.decode_16bit_int()

exported = validate(self.calculate_value(exported, energywsf), ">=", 0)
exported = validate(self.calculate_value(exported, energywsf), ">", 0)
exporteda = self.calculate_value(exporteda, energywsf)
exportedb = self.calculate_value(exportedb, energywsf)
exportedc = self.calculate_value(exportedc, energywsf)
imported = validate(self.calculate_value(imported, energywsf), ">=", 0)
imported = validate(self.calculate_value(imported, energywsf), ">", 0)
importeda = self.calculate_value(importeda, energywsf)
importedb = self.calculate_value(importedb, energywsf)
importedc = self.calculate_value(importedc, energywsf)
Expand Down Expand Up @@ -641,7 +641,7 @@ def read_modbus_data_inverter(self):

acenergy = decoder.decode_32bit_uint()
acenergysf = decoder.decode_16bit_uint()
acenergy = validate(self.calculate_value(acenergy, acenergysf), ">=", 0)
acenergy = validate(self.calculate_value(acenergy, acenergysf), ">", 0)

self.data["acenergy"] = round(acenergy * 0.001, 3)

Expand Down Expand Up @@ -852,7 +852,7 @@ def decode_string(decoder):
#0x82 - 2 - SoH %
battery_SoH = decoder.decode_32bit_float()
#0x84 - 2 - SoC %
battery_SoC = validate(decoder.decode_32bit_float(), ">=", 0.0)
battery_SoC = validate(decoder.decode_32bit_float(), ">", 0.0)
battery_SoC = validate(battery_SoC, "<", 101)

self.data[battery_prefix + 'temp_avg'] = round(tempavg, 1)
Expand Down

0 comments on commit 44a77a2

Please sign in to comment.