Skip to content

Commit aa70344

Browse files
authored
Merge pull request #16 from klejejs/fix/#15_operational-status-diplomat
Fix operational status for Thermia Diplomat heat pumps
2 parents 2f0ec4e + b321436 commit aa70344

2 files changed

Lines changed: 18 additions & 2 deletions

File tree

ThermiaOnlineAPI/const.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@
7878
REG_OPERATIONAL_STATUS_PRIO1 = (
7979
"REG_OPERATIONAL_STATUS_PRIO1" # Operational status for most heat pumps
8080
)
81+
COMP_STATUS = "COMP_STATUS" # Operational status for Diplomat heat pumps
8182
COMP_STATUS_ITEC = "COMP_STATUS_ITEC" # Operational status for ITEC heat pumps
8283
REG_OPERATIONAL_STATUS_PRIORITY_BITMASK = (
8384
"REG_OPERATIONAL_STATUS_PRIORITY_BITMASK" # Operational status for Atlas heat pumps

ThermiaOnlineAPI/model/HeatPump.py

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
REG_OPER_TIME_IMM3,
2828
REG_PID,
2929
REG_RETURN_LINE,
30+
COMP_STATUS,
3031
COMP_STATUS_ITEC,
3132
REG_SUPPLY_LINE,
3233
DATETIME_FORMAT,
@@ -59,6 +60,7 @@ def __init__(self, device_data: dict, api_interface: "ThermiaAPI"):
5960
self.__device_config: Dict[str, Optional[str]] = {
6061
"operational_status_register": None,
6162
"operational_status_valueNamePrefix": None,
63+
"operational_status_minRegisterValue": None,
6264
}
6365

6466
# GROUPS
@@ -382,9 +384,17 @@ def __get_operational_statuses_from_operational_status(self) -> Optional[Dict]:
382384
self.__device_config[
383385
"operational_status_register"
384386
] = 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_"
385395
self.__device_config[
386-
"operational_status_valueNamePrefix"
387-
] = "REG_VALUE_"
396+
"operational_status_minRegisterValue"
397+
] = "4" # 4 is OFF
388398
return data.get("valueNames", [])
389399

390400
return None
@@ -594,6 +604,11 @@ def operational_status(self) -> Optional[Union[str, List[str]]]:
594604
data_items_list.sort(key=lambda x: x[0], reverse=True)
595605
list_of_current_operation_modes = []
596606

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+
597612
for value, name in data_items_list:
598613
if value <= current_register_value:
599614
current_register_value -= value

0 commit comments

Comments
 (0)