Browse Source

fix variable load_daily_energy

subDesTagesMitExtraKaese 1 month ago
parent
commit
006552b680
2 changed files with 6 additions and 1 deletions
  1. 1 1
      src/variables.py
  2. 5 0
      tests/variable_test.py

+ 1 - 1
src/variables.py

@@ -232,7 +232,7 @@ status_registers = VariableContainer(
     Variable(0x3050, True,  False, [0x04], "W", 100, "solar_panel_power", "Solar panel power", None, None),
     Variable(0x3052, False, False, [0x04], "kWh", 100, "solar_panel_daily_energy", "Daily solar panel energy", None, None),
     Variable(0x3053, True,  False, [0x04], "kWh", 100, "solar_panel_total_energy", "Total solar panel energy", None, None),
-    Variable(0x3055, True,  False, [0x04], "kWh", 100, "load_daily_energy", "Daily load energy", None, None),
+    Variable(0x3055, False, False, [0x04], "kWh", 100, "load_daily_energy", "Daily load energy", None, None),
     Variable(0x3056, True,  False, [0x04], "kWh", 100, "load_total_energy", "Total load energy", None, None),
     Variable(0x3058, False, False, [0x04], "min", 1, "total_light_time_during_the_day", "Total light time during the day", None, None),
     Variable(0x309D, False, False, [0x04], "", 1, "run_days", "Number of running days", None, None),

+ 5 - 0
tests/variable_test.py

@@ -21,6 +21,11 @@ class TestVariables(unittest.TestCase):
             is_32_bit = next(group).is_32_bit
             for variable in group:
                 self.assertEqual(variable.is_32_bit, is_32_bit)
+    def test_overlap(self):
+        for variable in variables:
+            if variable.is_32_bit:
+                vs = [v for v in variables if v.address == variable.address + 1]
+                self.assertEqual([], vs)
     def test_indexer(self):
         variable = variables['battery_percentage']
         self.assertEqual('battery_percentage', variable.name)