Repository: mvn23/pyotgw (language: python)

Issue:
Thermostat value set once and never updated
Some Thermostat values (noticably the control setpoint), are updated once after restart, but never updated.

This problem was previously discussed here: https://github.com/home-assistant/core/issues/108018


Discussion / hints:

Fix patch:
diff --git a/pyotgw/pyotgw.py b/pyotgw/pyotgw.py
index af86ac1..efe0af0 100644
--- a/pyotgw/pyotgw.py
+++ b/pyotgw/pyotgw.py
@@ -275,12 +275,25 @@ async def get_status(self):
             vh_device_status = fields[23].split("/")
             vh_master_status = vh_device_status[0]
             vh_slave_status = vh_device_status[1]
-            status = {
+            thermostat_status = {
                 v.DATA_MASTER_CH_ENABLED: int(master_status[7]),
                 v.DATA_MASTER_DHW_ENABLED: int(master_status[6]),
                 v.DATA_MASTER_COOLING_ENABLED: int(master_status[5]),
                 v.DATA_MASTER_OTC_ENABLED: int(master_status[4]),
                 v.DATA_MASTER_CH2_ENABLED: int(master_status[3]),
+                v.DATA_CONTROL_SETPOINT: float(fields[1]),
+                v.DATA_ROOM_SETPOINT: float(fields[7]),
+                v.DATA_COOLING_CONTROL: float(fields[3]),
+                v.DATA_CONTROL_SETPOINT_2: float(fields[4]),
+                v.DATA_ROOM_SETPOINT_2: float(fields[11]),
+                v.DATA_ROOM_TEMP: float(fields[12]),
+                v.DATA_VH_MASTER_VENT_ENABLED: int(vh_master_status[7]),
+                v.DATA_VH_MASTER_BYPASS_POS: int(vh_master_status[6]),
+                v.DATA_VH_MASTER_BYPASS_MODE: int(vh_master_status[5]),
+                v.DATA_VH_MASTER_FREE_VENT_MODE: int(vh_master_status[4]),
+                v.DATA_VH_CONTROL_SETPOINT: int(fields[24]),
+            }
+            boiler_status = {
                 v.DATA_SLAVE_FAULT_IND: int(slave_status[7]),
                 v.DATA_SLAVE_CH_ACTIVE: int(slave_status[6]),
                 v.DATA_SLAVE_DHW_ACTIVE: int(slave_status[5]),
@@ -288,22 +301,16 @@ async def get_status(self):
                 v.DATA_SLAVE_COOLING_ACTIVE: int(slave_status[3]),
                 v.DATA_SLAVE_CH2_ACTIVE: int(slave_status[2]),
                 v.DATA_SLAVE_DIAG_IND: int(slave_status[1]),
-                v.DATA_CONTROL_SETPOINT: float(fields[1]),
                 v.DATA_REMOTE_TRANSFER_DHW: int(remote_params[0][7]),
                 v.DATA_REMOTE_TRANSFER_MAX_CH: int(remote_params[0][6]),
                 v.DATA_REMOTE_RW_DHW: int(remote_params[1][7]),
                 v.DATA_REMOTE_RW_MAX_CH: int(remote_params[1][6]),
-                v.DATA_COOLING_CONTROL: float(fields[3]),
-                v.DATA_CONTROL_SETPOINT_2: float(fields[4]),
                 v.DATA_SLAVE_MAX_RELATIVE_MOD: float(fields[5]),
                 v.DATA_SLAVE_MAX_CAPACITY: int(capmodlimits[0]),
                 v.DATA_SLAVE_MIN_MOD_LEVEL: int(capmodlimits[1]),
-                v.DATA_ROOM_SETPOINT: float(fields[7]),
                 v.DATA_REL_MOD_LEVEL: float(fields[8]),
                 v.DATA_CH_WATER_PRESS: float(fields[9]),
                 v.DATA_DHW_FLOW_RATE: float(fields[10]),
-                v.DATA_ROOM_SETPOINT_2: float(fields[11]),
-                v.DATA_ROOM_TEMP: float(fields[12]),
                 v.DATA_CH_WATER_TEMP: float(fields[13]),
                 v.DATA_DHW_TEMP: float(fields[14]),
                 v.DATA_OUTSIDE_TEMP: float(fields[15]),
@@ -316,18 +323,12 @@ async def get_status(self):
                 v.DATA_SLAVE_CH_MIN_SETP: int(ch_setp_bounds[1]),
                 v.DATA_DHW_SETPOINT: float(fields[21]),
                 v.DATA_MAX_CH_SETPOINT: float(fields[22]),
-                v.DATA_VH_MASTER_VENT_ENABLED: int(vh_master_status[7]),
-                v.DATA_VH_MASTER_BYPASS_POS: int(vh_master_status[6]),
-                v.DATA_VH_MASTER_BYPASS_MODE: int(vh_master_status[5]),
-                v.DATA_VH_MASTER_FREE_VENT_MODE: int(vh_master_status[4]),
                 v.DATA_VH_SLAVE_FAULT_INDICATE: int(vh_slave_status[7]),
                 v.DATA_VH_SLAVE_VENT_MODE: int(vh_slave_status[6]),
                 v.DATA_VH_SLAVE_BYPASS_STATUS: int(vh_slave_status[5]),
                 v.DATA_VH_SLAVE_BYPASS_AUTO_STATUS: int(vh_slave_status[4]),
                 v.DATA_VH_SLAVE_FREE_VENT_STATUS: int(vh_slave_status[3]),
                 v.DATA_VH_SLAVE_DIAG_INDICATE: int(vh_slave_status[1]),
-                v.DATA_VH_CONTROL_SETPOINT: int(fields[24]),
-                v.DATA_VH_RELATIVE_VENT: int(fields[25]),
                 v.DATA_TOTAL_BURNER_STARTS: int(fields[26]),
                 v.DATA_CH_PUMP_STARTS: int(fields[27]),
                 v.DATA_DHW_PUMP_STARTS: int(fields[28]),
@@ -336,6 +337,7 @@ async def get_status(self):
                 v.DATA_CH_PUMP_HOURS: int(fields[31]),
                 v.DATA_DHW_PUMP_HOURS: int(fields[32]),
                 v.DATA_DHW_BURNER_HOURS: int(fields[33]),
+                v.DATA_VH_RELATIVE_VENT: int(fields[25]),
             }
         else:
             device_status = fields[0].split("/")
@@ -345,12 +347,17 @@ async def get_status(self):
             capmodlimits = fields[4].split("/")
             dhw_setp_bounds = fields[13].split("/")
             ch_setp_bounds = fields[14].split("/")
-            status = {
+            thermostat_status = {
                 v.DATA_MASTER_CH_ENABLED: int(master_status[7]),
                 v.DATA_MASTER_DHW_ENABLED: int(master_status[6]),
                 v.DATA_MASTER_COOLING_ENABLED: int(master_status[5]),
                 v.DATA_MASTER_OTC_ENABLED: int(master_status[4]),
                 v.DATA_MASTER_CH2_ENABLED: int(master_status[3]),
+                v.DATA_CONTROL_SETPOINT: float(fields[1]),
+                v.DATA_ROOM_SETPOINT: float(fields[5]),
+                v.DATA_ROOM_TEMP: float(fields[8]),
+            }
+            boiler_status = {
                 v.DATA_SLAVE_FAULT_IND: int(slave_status[7]),
                 v.DATA_SLAVE_CH_ACTIVE: int(slave_status[6]),
                 v.DATA_SLAVE_DHW_ACTIVE: int(slave_status[5]),
@@ -358,7 +365,6 @@ async def get_status(self):
                 v.DATA_SLAVE_COOLING_ACTIVE: int(slave_status[3]),
                 v.DATA_SLAVE_CH2_ACTIVE: int(slave_status[2]),
                 v.DATA_SLAVE_DIAG_IND: int(slave_status[1]),
-                v.DATA_CONTROL_SETPOINT: float(fields[1]),
                 v.DATA_REMOTE_TRANSFER_DHW: int(remote_params[0][7]),
                 v.DATA_REMOTE_TRANSFER_MAX_CH: int(remote_params[0][6]),
                 v.DATA_REMOTE_RW_DHW: int(remote_params[1][7]),
@@ -366,10 +372,8 @@ async def get_status(self):
                 v.DATA_SLAVE_MAX_RELATIVE_MOD: float(fields[3]),
                 v.DATA_SLAVE_MAX_CAPACITY: int(capmodlimits[0]),
                 v.DATA_SLAVE_MIN_MOD_LEVEL: int(capmodlimits[1]),
-                v.DATA_ROOM_SETPOINT: float(fields[5]),
                 v.DATA_REL_MOD_LEVEL: float(fields[6]),
                 v.DATA_CH_WATER_PRESS: float(fields[7]),
-                v.DATA_ROOM_TEMP: float(fields[8]),
                 v.DATA_CH_WATER_TEMP: float(fields[9]),
                 v.DATA_DHW_TEMP: float(fields[10]),
                 v.DATA_OUTSIDE_TEMP: float(fields[11]),
@@ -389,7 +393,10 @@ async def get_status(self):
                 v.DATA_DHW_PUMP_HOURS: int(fields[23]),
                 v.DATA_DHW_BURNER_HOURS: int(fields[24]),
             }
-        self.status.submit_full_update({v.BOILER: status, v.THERMOSTAT: status})
+        self.status.submit_full_update({
+            v.BOILER: boiler_status,
+            v.THERMOSTAT: thermostat_status
+        })
         return self.status.status
 
     async def set_hot_water_ovrd(self, state, timeout=v.OTGW_DEFAULT_TIMEOUT):


Test patch:
diff --git a/tests/data.py b/tests/data.py
index f8183bc..18939a6 100644
--- a/tests/data.py
+++ b/tests/data.py
@@ -114,11 +114,6 @@
 )
 _status_expect_5 = {
     v.BOILER: {
-        v.DATA_MASTER_CH_ENABLED: 0,
-        v.DATA_MASTER_DHW_ENABLED: 1,
-        v.DATA_MASTER_COOLING_ENABLED: 0,
-        v.DATA_MASTER_OTC_ENABLED: 1,
-        v.DATA_MASTER_CH2_ENABLED: 0,
         v.DATA_SLAVE_FAULT_IND: 1,
         v.DATA_SLAVE_CH_ACTIVE: 0,
         v.DATA_SLAVE_DHW_ACTIVE: 1,
@@ -126,22 +121,16 @@
         v.DATA_SLAVE_COOLING_ACTIVE: 1,
         v.DATA_SLAVE_CH2_ACTIVE: 0,
         v.DATA_SLAVE_DIAG_IND: 1,
-        v.DATA_CONTROL_SETPOINT: 1.23,
         v.DATA_REMOTE_TRANSFER_DHW: 1,
         v.DATA_REMOTE_TRANSFER_MAX_CH: 0,
         v.DATA_REMOTE_RW_DHW: 0,
         v.DATA_REMOTE_RW_MAX_CH: 1,
-        v.DATA_COOLING_CONTROL: 2.34,
-        v.DATA_CONTROL_SETPOINT_2: 3.45,
         v.DATA_SLAVE_MAX_RELATIVE_MOD: 4.56,
         v.DATA_SLAVE_MAX_CAPACITY: 1,
         v.DATA_SLAVE_MIN_MOD_LEVEL: 0,
-        v.DATA_ROOM_SETPOINT: 5.67,
         v.DATA_REL_MOD_LEVEL: 6.78,
         v.DATA_CH_WATER_PRESS: 7.89,
         v.DATA_DHW_FLOW_RATE: 8.90,
-        v.DATA_ROOM_SETPOINT_2: 9.09,
-        v.DATA_ROOM_TEMP: 0.98,
         v.DATA_CH_WATER_TEMP: 9.87,
         v.DATA_DHW_TEMP: 8.76,
         v.DATA_OUTSIDE_TEMP: 7.65,
@@ -154,17 +143,12 @@
         v.DATA_SLAVE_CH_MIN_SETP: 90,
         v.DATA_DHW_SETPOINT: 4.32,
         v.DATA_MAX_CH_SETPOINT: 3.21,
-        v.DATA_VH_MASTER_VENT_ENABLED: 0,
-        v.DATA_VH_MASTER_BYPASS_POS: 1,
-        v.DATA_VH_MASTER_BYPASS_MODE: 0,
-        v.DATA_VH_MASTER_FREE_VENT_MODE: 1,
         v.DATA_VH_SLAVE_FAULT_INDICATE: 1,
         v.DATA_VH_SLAVE_VENT_MODE: 0,
         v.DATA_VH_SLAVE_BYPASS_STATUS: 1,
         v.DATA_VH_SLAVE_BYPASS_AUTO_STATUS: 0,
         v.DATA_VH_SLAVE_FREE_VENT_STATUS: 1,
         v.DATA_VH_SLAVE_DIAG_INDICATE: 1,
-        v.DATA_VH_CONTROL_SETPOINT: 9,
         v.DATA_VH_RELATIVE_VENT: 8,
         v.DATA_TOTAL_BURNER_STARTS: 7654,
         v.DATA_CH_PUMP_STARTS: 6543,
@@ -182,61 +166,17 @@
         v.DATA_MASTER_COOLING_ENABLED: 0,
         v.DATA_MASTER_OTC_ENABLED: 1,
         v.DATA_MASTER_CH2_ENABLED: 0,
-        v.DATA_SLAVE_FAULT_IND: 1,
-        v.DATA_SLAVE_CH_ACTIVE: 0,
-        v.DATA_SLAVE_DHW_ACTIVE: 1,
-        v.DATA_SLAVE_FLAME_ON: 0,
-        v.DATA_SLAVE_COOLING_ACTIVE: 1,
-        v.DATA_SLAVE_CH2_ACTIVE: 0,
-        v.DATA_SLAVE_DIAG_IND: 1,
         v.DATA_CONTROL_SETPOINT: 1.23,
-        v.DATA_REMOTE_TRANSFER_DHW: 1,
-        v.DATA_REMOTE_TRANSFER_MAX_CH: 0,
-        v.DATA_REMOTE_RW_DHW: 0,
-        v.DATA_REMOTE_RW_MAX_CH: 1,
+        v.DATA_ROOM_SETPOINT: 5.67,
         v.DATA_COOLING_CONTROL: 2.34,
         v.DATA_CONTROL_SETPOINT_2: 3.45,
-        v.DATA_SLAVE_MAX_RELATIVE_MOD: 4.56,
-        v.DATA_SLAVE_MAX_CAPACITY: 1,
-        v.DATA_SLAVE_MIN_MOD_LEVEL: 0,
-        v.DATA_ROOM_SETPOINT: 5.67,
-        v.DATA_REL_MOD_LEVEL: 6.78,
-        v.DATA_CH_WATER_PRESS: 7.89,
-        v.DATA_DHW_FLOW_RATE: 8.90,
         v.DATA_ROOM_SETPOINT_2: 9.09,
         v.DATA_ROOM_TEMP: 0.98,
-        v.DATA_CH_WATER_TEMP: 9.87,
-        v.DATA_DHW_TEMP: 8.76,
-        v.DATA_OUTSIDE_TEMP: 7.65,
-        v.DATA_RETURN_WATER_TEMP: 6.54,
-        v.DATA_CH_WATER_TEMP_2: 5.43,
-        v.DATA_EXHAUST_TEMP: 2,
-        v.DATA_SLAVE_DHW_MAX_SETP: 34,
-        v.DATA_SLAVE_DHW_MIN_SETP: 56,
-        v.DATA_SLAVE_CH_MAX_SETP: 78,
-        v.DATA_SLAVE_CH_MIN_SETP: 90,
-        v.DATA_DHW_SETPOINT: 4.32,
-        v.DATA_MAX_CH_SETPOINT: 3.21,
         v.DATA_VH_MASTER_VENT_ENABLED: 0,
         v.DATA_VH_MASTER_BYPASS_POS: 1,
         v.DATA_VH_MASTER_BYPASS_MODE: 0,
         v.DATA_VH_MASTER_FREE_VENT_MODE: 1,
-        v.DATA_VH_SLAVE_FAULT_INDICATE: 1,
-        v.DATA_VH_SLAVE_VENT_MODE: 0,
-        v.DATA_VH_SLAVE_BYPASS_STATUS: 1,
-        v.DATA_VH_SLAVE_BYPASS_AUTO_STATUS: 0,
-        v.DATA_VH_SLAVE_FREE_VENT_STATUS: 1,
-        v.DATA_VH_SLAVE_DIAG_INDICATE: 1,
         v.DATA_VH_CONTROL_SETPOINT: 9,
-        v.DATA_VH_RELATIVE_VENT: 8,
-        v.DATA_TOTAL_BURNER_STARTS: 7654,
-        v.DATA_CH_PUMP_STARTS: 6543,
-        v.DATA_DHW_PUMP_STARTS: 54321,
-        v.DATA_DHW_BURNER_STARTS: 43210,
-        v.DATA_TOTAL_BURNER_HOURS: 32101,
-        v.DATA_CH_PUMP_HOURS: 21012,
-        v.DATA_DHW_PUMP_HOURS: 10123,
-        v.DATA_DHW_BURNER_HOURS: 99,
     },
 }
 
@@ -246,11 +186,6 @@
 )
 _status_expect_4 = {
     v.BOILER: {
-        v.DATA_MASTER_CH_ENABLED: 0,
-        v.DATA_MASTER_DHW_ENABLED: 1,
-        v.DATA_MASTER_COOLING_ENABLED: 0,
-        v.DATA_MASTER_OTC_ENABLED: 1,
-        v.DATA_MASTER_CH2_ENABLED: 0,
         v.DATA_SLAVE_FAULT_IND: 1,
         v.DATA_SLAVE_CH_ACTIVE: 0,
         v.DATA_SLAVE_DHW_ACTIVE: 1,
@@ -258,7 +193,6 @@
         v.DATA_SLAVE_COOLING_ACTIVE: 1,
         v.DATA_SLAVE_CH2_ACTIVE: 0,
         v.DATA_SLAVE_DIAG_IND: 1,
-        v.DATA_CONTROL_SETPOINT: 1.23,
         v.DATA_REMOTE_TRANSFER_DHW: 1,
         v.DATA_REMOTE_TRANSFER_MAX_CH: 0,
         v.DATA_REMOTE_RW_DHW: 0,
@@ -266,10 +200,8 @@
         v.DATA_SLAVE_MAX_RELATIVE_MOD: 2.34,
         v.DATA_SLAVE_MAX_CAPACITY: 0,
         v.DATA_SLAVE_MIN_MOD_LEVEL: 1,
-        v.DATA_ROOM_SETPOINT: 3.45,
         v.DATA_REL_MOD_LEVEL: 4.56,
         v.DATA_CH_WATER_PRESS: 5.67,
-        v.DATA_ROOM_TEMP: 6.78,
         v.DATA_CH_WATER_TEMP: 7.89,
         v.DATA_DHW_TEMP: 8.90,
         v.DATA_OUTSIDE_TEMP: 9.09,
@@ -296,43 +228,9 @@
         v.DATA_MASTER_COOLING_ENABLED: 0,
         v.DATA_MASTER_OTC_ENABLED: 1,
         v.DATA_MASTER_CH2_ENABLED: 0,
-        v.DATA_SLAVE_FAULT_IND: 1,
-        v.DATA_SLAVE_CH_ACTIVE: 0,
-        v.DATA_SLAVE_DHW_ACTIVE: 1,
-        v.DATA_SLAVE_FLAME_ON: 0,
-        v.DATA_SLAVE_COOLING_ACTIVE: 1,
-        v.DATA_SLAVE_CH2_ACTIVE: 0,
-        v.DATA_SLAVE_DIAG_IND: 1,
         v.DATA_CONTROL_SETPOINT: 1.23,
-        v.DATA_REMOTE_TRANSFER_DHW: 1,
-        v.DATA_REMOTE_TRANSFER_MAX_CH: 0,
-        v.DATA_REMOTE_RW_DHW: 0,
-        v.DATA_REMOTE_RW_MAX_CH: 1,
-        v.DATA_SLAVE_MAX_RELATIVE_MOD: 2.34,
-        v.DATA_SLAVE_MAX_CAPACITY: 0,
-        v.DATA_SLAVE_MIN_MOD_LEVEL: 1,
         v.DATA_ROOM_SETPOINT: 3.45,
-        v.DATA_REL_MOD_LEVEL: 4.56,
-        v.DATA_CH_WATER_PRESS: 5.67,
         v.DATA_ROOM_TEMP: 6.78,
-        v.DATA_CH_WATER_TEMP: 7.89,
-        v.DATA_DHW_TEMP: 8.90,
-        v.DATA_OUTSIDE_TEMP: 9.09,
-        v.DATA_RETURN_WATER_TEMP: 0.98,
-        v.DATA_SLAVE_DHW_MAX_SETP: 12,
-        v.DATA_SLAVE_DHW_MIN_SETP: 34,
-        v.DATA_SLAVE_CH_MAX_SETP: 56,
-        v.DATA_SLAVE_CH_MIN_SETP: 78,
-        v.DATA_DHW_SETPOINT: 9.87,
-        v.DATA_MAX_CH_SETPOINT: 8.76,
-        v.DATA_TOTAL_BURNER_STARTS: 1234,
-        v.DATA_CH_PUMP_STARTS: 2345,
-        v.DATA_DHW_PUMP_STARTS: 3456,
-        v.DATA_DHW_BURNER_STARTS: 4567,
-        v.DATA_TOTAL_BURNER_HOURS: 5678,
-        v.DATA_CH_PUMP_HOURS: 6789,
-        v.DATA_DHW_PUMP_HOURS: 7890,
-        v.DATA_DHW_BURNER_HOURS: 8909,
     },
 }