Skip to content

Commit 5d9ed6d

Browse files
committed
Add model id value to heat pump model
1 parent f5ee654 commit 5d9ed6d

2 files changed

Lines changed: 35 additions & 27 deletions

File tree

ThermiaOnlineAPI/model/HeatPump.py

Lines changed: 31 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -144,19 +144,19 @@ def set_temperature(self, temperature: int):
144144

145145
self._LOGGER.info("Setting temperature to " + str(temperature))
146146

147-
self.__status[
148-
"heatingEffect"
149-
] = temperature # update local state before refetching data
147+
self.__status["heatingEffect"] = (
148+
temperature # update local state before refetching data
149+
)
150150
self.__api_interface.set_temperature(self, temperature)
151151
self.update_data()
152152

153153
def set_operation_mode(self, mode: str):
154154
self._LOGGER.info("Setting operation mode to " + str(mode))
155155

156156
if self.__group_operational_operation is not None:
157-
self.__group_operational_operation[
158-
"current"
159-
] = mode # update local state before refetching data
157+
self.__group_operational_operation["current"] = (
158+
mode # update local state before refetching data
159+
)
160160
self.__api_interface.set_operation_mode(self, mode)
161161
self.update_data()
162162

@@ -167,9 +167,9 @@ def set_hot_water_switch_state(self, state: int):
167167
self._LOGGER.error("Hot water switch not available")
168168
return
169169

170-
self.__group_hot_water[
171-
"hot_water_switch"
172-
] = state # update local state before refetching data
170+
self.__group_hot_water["hot_water_switch"] = (
171+
state # update local state before refetching data
172+
)
173173
self.__api_interface.set_hot_water_switch_state(self, state)
174174
self.update_data()
175175

@@ -180,9 +180,9 @@ def set_hot_water_boost_switch_state(self, state: int):
180180
self._LOGGER.error("Hot water switch not available")
181181
return
182182

183-
self.__group_hot_water[
184-
"hot_water_boost_switch"
185-
] = state # update local state before refetching data
183+
self.__group_hot_water["hot_water_boost_switch"] = (
184+
state # update local state before refetching data
185+
)
186186
self.__api_interface.set_hot_water_boost_switch_state(self, state)
187187
self.update_data()
188188

@@ -381,12 +381,12 @@ def __get_operational_statuses_from_operational_status(self) -> Optional[Dict]:
381381
# Try to get the data from the REG_OPERATIONAL_STATUS_PRIO1 register
382382
data = self.__get_register_from_operational_status(REG_OPERATIONAL_STATUS_PRIO1)
383383
if data is not None:
384-
self.__device_config[
385-
"operational_status_register"
386-
] = REG_OPERATIONAL_STATUS_PRIO1
387-
self.__device_config[
388-
"operational_status_valueNamePrefix"
389-
] = "REG_VALUE_STATUS_"
384+
self.__device_config["operational_status_register"] = (
385+
REG_OPERATIONAL_STATUS_PRIO1
386+
)
387+
self.__device_config["operational_status_valueNamePrefix"] = (
388+
"REG_VALUE_STATUS_"
389+
)
390390
return data.get("valueNames", [])
391391

392392
# Try to get the data from the COMP_STATUS_ITEC register
@@ -401,9 +401,9 @@ def __get_operational_statuses_from_operational_status(self) -> Optional[Dict]:
401401
REG_OPERATIONAL_STATUS_PRIORITY_BITMASK
402402
)
403403
if data is not None:
404-
self.__device_config[
405-
"operational_status_register"
406-
] = REG_OPERATIONAL_STATUS_PRIORITY_BITMASK
404+
self.__device_config["operational_status_register"] = (
405+
REG_OPERATIONAL_STATUS_PRIORITY_BITMASK
406+
)
407407
self.__device_config["operational_status_valueNamePrefix"] = "REG_VALUE_"
408408
return data.get("valueNames", [])
409409

@@ -412,9 +412,9 @@ def __get_operational_statuses_from_operational_status(self) -> Optional[Dict]:
412412
if data is not None:
413413
self.__device_config["operational_status_register"] = COMP_STATUS
414414
self.__device_config["operational_status_valueNamePrefix"] = "COMP_VALUE_"
415-
self.__device_config[
416-
"operational_status_minRegisterValue"
417-
] = "4" # 4 is OFF
415+
self.__device_config["operational_status_minRegisterValue"] = (
416+
"4" # 4 is OFF
417+
)
418418
return data.get("valueNames", [])
419419

420420
return None
@@ -451,9 +451,9 @@ def __get_all_visible_operational_statuses_from_operational_status(
451451
return ChainMap()
452452

453453
operation_modes_map = map(
454-
lambda item: {item[0]: item[1].get("name")}
455-
if item[1].get("visible")
456-
else {},
454+
lambda item: (
455+
{item[0]: item[1].get("name")} if item[1].get("visible") else {}
456+
),
457457
data.items(),
458458
)
459459

@@ -538,6 +538,10 @@ def model(self):
538538
"thermiaName"
539539
)
540540

541+
@property
542+
def model_id(self):
543+
return get_dict_value_or_default(self.__device_data, "profile", {}).get("name")
544+
541545
@property
542546
def has_indoor_temp_sensor(self):
543547
return get_dict_value_or_none(self.__status, "hasIndoorTempSensor")

example.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@
1919
heat_pump.debug()
2020

2121
print("\n")
22+
print("\n")
23+
24+
print("Heat pump model: " + str(heat_pump.model))
25+
print("Heat pump model id: " + str(heat_pump.model_id))
2226

2327
print("\n")
2428

0 commit comments

Comments
 (0)