@@ -59,6 +59,7 @@ def __init__(self, device_data: dict, api_interface: "ThermiaAPI"):
5959 # GROUPS
6060 self .__group_temperatures = None
6161 self .__group_operational_status = None
62+ self .__operational_status_register = None
6263 self .__group_operational_time = None
6364 self .__group_operational_operation = None
6465 self .__group_hot_water : Dict [str , Optional [int ]] = {
@@ -344,9 +345,15 @@ def __get_value_by_key_and_register_name_from_operational_status(
344345 return None
345346
346347 def __get_operational_statuses_from_operational_status (self ) -> Optional [Dict ]:
348+ if self .__operational_status_register is not None :
349+ return self .__get_register_from_operational_status (
350+ self .__operational_status_register
351+ )
352+
347353 # Try to get the data from the REG_OPERATIONAL_STATUS_PRIO1 register
348354 data = self .__get_register_from_operational_status (REG_OPERATIONAL_STATUS_PRIO1 )
349355 if data is not None :
356+ self .__operational_status_register = REG_OPERATIONAL_STATUS_PRIO1
350357 return {
351358 "registerValues" : data .get ("valueNames" , []),
352359 "valueNamePrefix" : "REG_VALUE_STATUS_" ,
@@ -355,6 +362,7 @@ def __get_operational_statuses_from_operational_status(self) -> Optional[Dict]:
355362 # Try to get the data from the COMP_STATUS_ITEC register
356363 data = self .__get_register_from_operational_status (COMP_STATUS_ITEC )
357364 if data is not None :
365+ self .__operational_status_register = COMP_STATUS_ITEC
358366 return {
359367 "registerValues" : data .get ("valueNames" , []),
360368 "valueNamePrefix" : "COMP_VALUE_" ,
@@ -365,6 +373,7 @@ def __get_operational_statuses_from_operational_status(self) -> Optional[Dict]:
365373 REG_OPERATIONAL_STATUS_PRIORITY_BITMASK
366374 )
367375 if data is not None :
376+ self .__operational_status_register = REG_OPERATIONAL_STATUS_PRIORITY_BITMASK
368377 return {
369378 "registerValues" : data .get ("valueNames" , []),
370379 "valueNamePrefix" : "REG_VALUE_STATUS_" ,
@@ -546,7 +555,15 @@ def cooling_supply_line_temperature(self):
546555
547556 @property
548557 def operational_status (self ):
549- data = self .__get_register_from_operational_status (REG_OPERATIONAL_STATUS_PRIO1 )
558+ if self .__operational_status_register is None :
559+ # Attempt to get the register from the status data
560+ self .__get_operational_statuses_from_operational_status ()
561+ if self .__operational_status_register is None :
562+ return None
563+
564+ data = self .__get_register_from_operational_status (
565+ self .__operational_status_register
566+ )
550567
551568 if data is None :
552569 return None
0 commit comments