Skip to content

Commit 063b501

Browse files
committed
Add climate "devices", remove debugging
1 parent 4b40b78 commit 063b501

File tree

1 file changed

+10
-13
lines changed

1 file changed

+10
-13
lines changed

plugwise/helper.py

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -799,7 +799,6 @@ def _scan_thermostats(self) -> None:
799799
the result to update the device_class of secondary thermostats.
800800
"""
801801
self._thermo_locs = self._match_locations()
802-
LOGGER.debug("HOI 1 thermo_locs: %s", self._thermo_locs)
803802

804803
thermo_matching: dict[str, int] = {
805804
"thermostat": 2,
@@ -813,16 +812,16 @@ def _scan_thermostats(self) -> None:
813812
self._rank_thermostat(thermo_matching, loc_id, dev_id, device)
814813

815814
for loc_id, loc_data in list(self._thermo_locs.items()):
816-
if loc_data["primary_prio"] == 0:
817-
self._thermo_locs.pop(loc_id)
818-
819-
LOGGER.debug("HOI 2 thermo_locs: %s", self._thermo_locs)
820-
# Update secondary thermostat class where needed
821-
for dev_id, device in self.gw_devices.items():
822-
if (loc_id := device["location"]) in self._thermo_locs:
823-
tl_loc_id = self._thermo_locs[loc_id]
824-
if "secondary" in tl_loc_id and dev_id in tl_loc_id["secondary"]:
825-
device["dev_class"] = "thermo_sensor"
815+
if loc_data["primary_prio"] != 0:
816+
self.gw_devices.update(
817+
{
818+
loc_id: {
819+
"dev_class": "climate",
820+
"name": loc_data["name"],
821+
"devices": loc_data["primary"]
822+
}
823+
}
824+
)
826825

827826
# All thermostat appliances can keep their device_class but must not become climate-entities in HA.
828827
# For each _thermo_loc a special climate-device must be created, with setpoint and temperature taken from the thermostat appliance with the lowest reported temperature.
@@ -865,8 +864,6 @@ def _rank_thermostat(
865864
if thermo_matching[appl_class] > self._thermo_locs[loc_id]["primary_prio"]:
866865
# Demote former primary
867866
if (tl_primary:= self._thermo_locs[loc_id]["primary"]):
868-
LOGGER.debug("HOI 3 tl_primary: %s", tl_primary)
869-
LOGGER.debug("HOI 4 secondary: %s", self._thermo_locs[loc_id]["secondary"])
870867
self._thermo_locs[loc_id]["secondary"].update(tl_primary)
871868

872869
# Crown primary

0 commit comments

Comments
 (0)