Skip to content

Commit d73911b

Browse files
authored
Merge pull request #142 from plugwise/fix_sm_thermostat
Fix/remove single_master_thermostat
2 parents a671852 + adfe2b6 commit d73911b

File tree

2 files changed

+6
-75
lines changed

2 files changed

+6
-75
lines changed

plugwise/smile.py

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -71,14 +71,11 @@ def _all_device_data(self) -> None:
7171

7272
self.gw_devices[device_id] = device
7373

74-
self.gw_data["active_device"] = self._opentherm_device or self._on_off_device
75-
self.gw_data["cooling_present"] = self._cooling_present
76-
self.gw_data["gateway_id"] = self.gateway_id
77-
self.gw_data["heater_id"] = self._heater_id
78-
self.gw_data["single_master_thermostat"] = (
79-
self._is_thermostat and not self._multi_thermostats
80-
)
8174
self.gw_data["smile_name"] = self.smile_name
75+
self.gw_data["gateway_id"] = self.gateway_id
76+
if self._is_thermostat:
77+
self.gw_data["heater_id"] = self._heater_id
78+
self.gw_data["cooling_present"] = self._cooling_present
8279

8380
def get_all_devices(self) -> None:
8481
"""Determine the devices present from the obtained XML-data."""

tests/test_smile.py

Lines changed: 2 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -388,8 +388,8 @@ async def device_test(self, smile=pw_smile.Smile, testdata=None, preset=False):
388388
extra = data[0]
389389
device_list = data[1]
390390

391-
self.active_device_present = extra["active_device"]
392-
self.cooling_present = extra["cooling_present"]
391+
if "heater_id" in extra:
392+
self.cooling_present = extra["cooling_present"]
393393
self.notifications = extra["notifications"]
394394
self._write_json("all_data", data)
395395
self._write_json("notifications", extra["notifications"])
@@ -650,10 +650,7 @@ async def test_connect_legacy_anna(self):
650650
assert smile._smile_legacy
651651

652652
await self.device_test(smile, testdata)
653-
_LOGGER.info(" # Assert master thermostat")
654-
assert smile._is_thermostat
655653
assert not smile._multi_thermostats
656-
assert self.active_device_present
657654
assert not self.notifications
658655

659656
await self.tinker_thermostat(
@@ -750,10 +747,7 @@ async def test_connect_legacy_anna_2(self):
750747
assert smile._smile_legacy
751748

752749
await self.device_test(smile, testdata)
753-
_LOGGER.info(" # Assert master thermostat")
754-
assert smile._is_thermostat
755750
assert not smile._multi_thermostats
756-
assert self.active_device_present
757751
assert not self.notifications
758752

759753
await self.tinker_thermostat(
@@ -823,9 +817,6 @@ async def test_connect_smile_p1_v2(self):
823817
assert smile._smile_legacy
824818

825819
await self.device_test(smile, testdata)
826-
_LOGGER.info(" # Assert no master thermostat")
827-
# it's not a thermostat :)
828-
assert not smile._is_thermostat
829820
assert not self.notifications
830821

831822
await smile.close_connection()
@@ -861,9 +852,6 @@ async def test_connect_smile_p1_v2_2(self):
861852
assert smile._smile_legacy
862853

863854
await self.device_test(smile, testdata)
864-
_LOGGER.info(" # Assert no master thermostat")
865-
# it's not a thermostat :)
866-
assert not smile._is_thermostat
867855
assert not self.notifications
868856

869857
await smile.close_connection()
@@ -946,10 +934,7 @@ async def test_connect_anna_v4(self):
946934
assert not smile._smile_legacy
947935

948936
await self.device_test(smile, testdata)
949-
_LOGGER.info(" # Assert master thermostat")
950-
assert smile._is_thermostat
951937
assert not smile._multi_thermostats
952-
assert self.active_device_present
953938
assert not self.notifications
954939

955940
await self.tinker_thermostat(
@@ -992,8 +977,6 @@ async def test_connect_anna_v4_no_tag(self):
992977
assert not smile._smile_legacy
993978

994979
await self.device_test(smile, testdata)
995-
_LOGGER.info(" # Assert master thermostat")
996-
assert smile._is_thermostat
997980
assert not smile._multi_thermostats
998981

999982
await self.tinker_thermostat(
@@ -1044,10 +1027,7 @@ async def test_connect_anna_without_boiler_fw3(self):
10441027
assert not smile._smile_legacy
10451028

10461029
await self.device_test(smile, testdata)
1047-
_LOGGER.info(" # Assert master thermostat")
1048-
assert smile._is_thermostat
10491030
assert not smile._multi_thermostats
1050-
assert self.active_device_present
10511031
assert not self.notifications
10521032

10531033
await self.tinker_thermostat(
@@ -1094,10 +1074,7 @@ async def test_connect_anna_without_boiler_fw4(self):
10941074
assert not smile._smile_legacy
10951075

10961076
await self.device_test(smile, testdata)
1097-
_LOGGER.info(" # Assert master thermostat")
1098-
assert smile._is_thermostat
10991077
assert not smile._multi_thermostats
1100-
assert self.active_device_present
11011078
assert not self.notifications
11021079

11031080
await self.tinker_thermostat(
@@ -1186,10 +1163,7 @@ async def test_connect_anna_without_boiler_fw42(self):
11861163
assert not smile._smile_legacy
11871164

11881165
await self.device_test(smile, testdata)
1189-
_LOGGER.info(" # Assert master thermostat")
1190-
assert smile._is_thermostat
11911166
assert not smile._multi_thermostats
1192-
assert self.active_device_present
11931167
assert not self.notifications
11941168

11951169
await self.tinker_thermostat(
@@ -1252,10 +1226,7 @@ async def test_connect_adam_plus_anna(self):
12521226
assert not smile._smile_legacy
12531227

12541228
await self.device_test(smile, testdata)
1255-
_LOGGER.info(" # Assert master thermostat")
1256-
assert smile._is_thermostat
12571229
assert not smile._multi_thermostats
1258-
assert self.active_device_present
12591230
assert not self.notifications
12601231

12611232
await self.tinker_thermostat(
@@ -1454,10 +1425,7 @@ async def test_connect_adam_plus_anna_new(self):
14541425
assert not smile._smile_legacy
14551426

14561427
await self.device_test(smile, testdata)
1457-
_LOGGER.info(" # Assert master thermostat")
1458-
assert smile._is_thermostat
14591428
assert smile._multi_thermostats
1460-
assert self.active_device_present
14611429

14621430
switch_change = await self.tinker_switch(
14631431
smile,
@@ -1601,10 +1569,7 @@ async def test_connect_adam_zone_per_device(self):
16011569
assert not smile._smile_legacy
16021570

16031571
await self.device_test(smile, testdata)
1604-
_LOGGER.info(" # Assert master thermostat")
1605-
assert smile._is_thermostat
16061572
assert smile._multi_thermostats
1607-
assert self.active_device_present
16081573

16091574
assert "af82e4ccf9c548528166d38e560662a4" in self.notifications
16101575
await smile.delete_notification()
@@ -2008,10 +1973,7 @@ async def test_connect_adam_multiple_devices_per_zone(self):
20081973
assert not smile._smile_legacy
20091974

20101975
await self.device_test(smile, testdata)
2011-
_LOGGER.info(" # Assert master thermostat")
2012-
assert smile._is_thermostat
20131976
assert smile._multi_thermostats
2014-
assert self.active_device_present
20151977

20161978
assert "af82e4ccf9c548528166d38e560662a4" in self.notifications
20171979

@@ -2109,9 +2071,6 @@ async def test_connect_p1v3(self):
21092071
assert not smile._smile_legacy
21102072

21112073
await self.device_test(smile, testdata)
2112-
# it's not a thermostat :)
2113-
assert not smile._is_thermostat
2114-
assert not self.cooling_present
21152074
assert not self.notifications
21162075

21172076
await smile.close_connection()
@@ -2145,9 +2104,6 @@ async def test_connect_p1v3solarfake(self):
21452104
assert not smile._smile_legacy
21462105

21472106
await self.device_test(smile, testdata)
2148-
_LOGGER.info(" # Assert nomaster thermostat")
2149-
# it's not a thermostat :)
2150-
assert not smile._is_thermostat
21512107
assert not self.notifications
21522108

21532109
await smile.close_connection()
@@ -2199,9 +2155,6 @@ async def test_connect_p1v3_full_option(self):
21992155
assert not smile._smile_legacy
22002156

22012157
await self.device_test(smile, testdata)
2202-
_LOGGER.info(" # Assert no master thermostat")
2203-
# it's not a thermostat :)
2204-
assert not smile._is_thermostat
22052158
assert not self.notifications
22062159

22072160
await smile.close_connection()
@@ -2255,10 +2208,7 @@ async def test_connect_anna_heatpump(self):
22552208

22562209
# Preset cooling_active to True, will turn to False due to the lowered outdoor temp
22572210
await self.device_test(smile, testdata, True)
2258-
_LOGGER.info(" # Assert master thermostat")
2259-
assert smile._is_thermostat
22602211
assert not smile._multi_thermostats
2261-
assert self.active_device_present
22622212
assert self.cooling_present
22632213
assert not self.notifications
22642214

@@ -2312,10 +2262,7 @@ async def test_connect_anna_heatpump_cooling(self):
23122262
assert not smile._smile_legacy
23132263

23142264
await self.device_test(smile, testdata)
2315-
_LOGGER.info(" # Assert master thermostat")
2316-
assert smile._is_thermostat
23172265
assert not smile._multi_thermostats
2318-
assert self.active_device_present
23192266
assert self.cooling_present
23202267
assert not self.notifications
23212268

@@ -2345,8 +2292,6 @@ async def test_connect_adam_plus_anna_copy_with_error_domain_added(self):
23452292
assert not smile._smile_legacy
23462293

23472294
await self.device_test(smile, testdata, True)
2348-
_LOGGER.info(" # Assert master thermostat")
2349-
assert smile._is_thermostat
23502295
assert not smile._multi_thermostats
23512296

23522297
assert "3d28a20e17cb47dca210a132463721d5" in self.notifications
@@ -2495,9 +2440,6 @@ async def test_connect_stretch_v31(self):
24952440
assert smile._smile_legacy
24962441

24972442
await self.device_test(smile, testdata)
2498-
_LOGGER.info(" # Assert no master thermostat")
2499-
# it's not a thermostat :)
2500-
assert not smile._is_thermostat
25012443

25022444
await smile.close_connection()
25032445
await self.disconnect(server, client)
@@ -2775,9 +2717,6 @@ async def test_connect_stretch_v23(self):
27752717
assert smile._smile_legacy
27762718

27772719
await self.device_test(smile, testdata)
2778-
_LOGGER.info(" # Assert no master thermostat")
2779-
# it's not a thermostat :)
2780-
assert not smile._is_thermostat
27812720

27822721
switch_change = await self.tinker_switch(
27832722
smile, "2587a7fcdd7e482dab03fda256076b4b"
@@ -2825,8 +2764,6 @@ async def test_connect_stretch_v27_no_domain(self):
28252764

28262765
await self.device_test(smile, testdata)
28272766
_LOGGER.info(" # Assert no master thermostat")
2828-
# it's not a thermostat :)
2829-
assert not smile._is_thermostat
28302767

28312768
switch_change = await self.tinker_switch(
28322769
smile, "8b8d14b242e24cd789743c828b9a2ea9"
@@ -2880,9 +2817,6 @@ async def test_connect_p1v4(self):
28802817
assert not smile._smile_legacy
28812818

28822819
await self.device_test(smile, testdata)
2883-
_LOGGER.info(" # Assert no master thermostat")
2884-
# it's not a thermostat :)
2885-
assert not smile._is_thermostat
28862820
assert not self.notifications
28872821

28882822
await smile.close_connection()

0 commit comments

Comments
 (0)