|
27 | 27 | REG_OPER_TIME_IMM3, |
28 | 28 | REG_PID, |
29 | 29 | REG_RETURN_LINE, |
| 30 | + COMP_STATUS, |
30 | 31 | COMP_STATUS_ITEC, |
31 | 32 | REG_SUPPLY_LINE, |
32 | 33 | DATETIME_FORMAT, |
@@ -59,6 +60,7 @@ def __init__(self, device_data: dict, api_interface: "ThermiaAPI"): |
59 | 60 | self.__device_config: Dict[str, Optional[str]] = { |
60 | 61 | "operational_status_register": None, |
61 | 62 | "operational_status_valueNamePrefix": None, |
| 63 | + "operational_status_minRegisterValue": None, |
62 | 64 | } |
63 | 65 |
|
64 | 66 | # GROUPS |
@@ -382,9 +384,17 @@ def __get_operational_statuses_from_operational_status(self) -> Optional[Dict]: |
382 | 384 | self.__device_config[ |
383 | 385 | "operational_status_register" |
384 | 386 | ] = REG_OPERATIONAL_STATUS_PRIORITY_BITMASK |
| 387 | + self.__device_config["operational_status_valueNamePrefix"] = "REG_VALUE_" |
| 388 | + return data.get("valueNames", []) |
| 389 | + |
| 390 | + # Try to get the data from the COMP_STATUS register |
| 391 | + data = self.__get_register_from_operational_status(COMP_STATUS) |
| 392 | + if data is not None: |
| 393 | + self.__device_config["operational_status_register"] = COMP_STATUS |
| 394 | + self.__device_config["operational_status_valueNamePrefix"] = "COMP_VALUE_" |
385 | 395 | self.__device_config[ |
386 | | - "operational_status_valueNamePrefix" |
387 | | - ] = "REG_VALUE_" |
| 396 | + "operational_status_minRegisterValue" |
| 397 | + ] = "4" # 4 is OFF |
388 | 398 | return data.get("valueNames", []) |
389 | 399 |
|
390 | 400 | return None |
@@ -594,6 +604,11 @@ def operational_status(self) -> Optional[Union[str, List[str]]]: |
594 | 604 | data_items_list.sort(key=lambda x: x[0], reverse=True) |
595 | 605 | list_of_current_operation_modes = [] |
596 | 606 |
|
| 607 | + if self.__device_config["operational_status_minRegisterValue"] is not None: |
| 608 | + current_register_value -= int( |
| 609 | + self.__device_config["operational_status_minRegisterValue"] |
| 610 | + ) |
| 611 | + |
597 | 612 | for value, name in data_items_list: |
598 | 613 | if value <= current_register_value: |
599 | 614 | current_register_value -= value |
|
0 commit comments