Skip to content

Commit f8fe02b

Browse files
authored
Merge pull request #416 from plugwise/del_control_state
Adam: remove use of control_state, xml-key no longer present
2 parents 14ec883 + 8d2c222 commit f8fe02b

File tree

10 files changed

+8
-63
lines changed

10 files changed

+8
-63
lines changed

CHANGELOG.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
# Changelog
22

3-
## Ongoing
3+
## v0.33.1 Bugfix for Adam
44

5-
- Fix error in manual fixture creation
5+
- Adam: remove use of control_state, xml-key no longer present.
6+
- Fix error in manual fixture creation.
67

78
## v0.33.0 Bugfixes, implement daily full-update
89

fixtures/adam_heatpump_cooling/all_data.json

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@
4242
"active_preset": "away",
4343
"available": true,
4444
"available_schedules": ["Opstaan weekdag", "Werkdag schema", "Weekend"],
45-
"control_state": "off",
4645
"dev_class": "zone_thermostat",
4746
"firmware": "2016-10-10T02:00:00+02:00",
4847
"hardware": "255",
@@ -155,7 +154,6 @@
155154
"active_preset": "away",
156155
"available": true,
157156
"available_schedules": ["Opstaan weekdag", "Werkdag schema", "Weekend"],
158-
"control_state": "off",
159157
"dev_class": "zone_thermostat",
160158
"firmware": "2016-10-10T02:00:00+02:00",
161159
"hardware": "255",
@@ -235,7 +233,6 @@
235233
"active_preset": "away",
236234
"available": true,
237235
"available_schedules": ["Opstaan weekdag", "Werkdag schema", "Weekend"],
238-
"control_state": "off",
239236
"dev_class": "zone_thermostat",
240237
"firmware": "2016-10-10T02:00:00+02:00",
241238
"hardware": "255",
@@ -366,7 +363,6 @@
366363
"active_preset": "away",
367364
"available": true,
368365
"available_schedules": ["Opstaan weekdag", "Werkdag schema", "Weekend"],
369-
"control_state": "off",
370366
"dev_class": "zone_thermostat",
371367
"firmware": "2016-10-10T02:00:00+02:00",
372368
"hardware": "255",
@@ -402,7 +398,6 @@
402398
"active_preset": "away",
403399
"available": true,
404400
"available_schedules": ["Opstaan weekdag", "Werkdag schema", "Weekend"],
405-
"control_state": "off",
406401
"dev_class": "zone_thermostat",
407402
"firmware": "2016-10-10T02:00:00+02:00",
408403
"hardware": "255",
@@ -437,7 +432,6 @@
437432
"ca79d23ae0094120b877558734cff85c": {
438433
"active_preset": "away",
439434
"available_schedules": ["Opstaan weekdag", "Werkdag schema", "Weekend"],
440-
"control_state": "off",
441435
"dev_class": "thermostat",
442436
"last_used": "Werkdag schema",
443437
"location": "fa5fa6b34f6b40a0972988b20e888ed4",
@@ -464,7 +458,6 @@
464458
"active_preset": "away",
465459
"available": true,
466460
"available_schedules": ["Opstaan weekdag", "Werkdag schema", "Weekend"],
467-
"control_state": "off",
468461
"dev_class": "zone_thermostat",
469462
"firmware": "2016-10-10T02:00:00+02:00",
470463
"hardware": "255",
@@ -500,7 +493,6 @@
500493
"active_preset": "away",
501494
"available": true,
502495
"available_schedules": ["Opstaan weekdag", "Werkdag schema", "Weekend"],
503-
"control_state": "off",
504496
"dev_class": "zone_thermostat",
505497
"firmware": "2016-10-10T02:00:00+02:00",
506498
"hardware": "255",
@@ -537,7 +529,6 @@
537529
"active_preset": "away",
538530
"available": true,
539531
"available_schedules": ["Opstaan weekdag", "Werkdag schema", "Weekend"],
540-
"control_state": "off",
541532
"dev_class": "zone_thermostat",
542533
"firmware": "2016-10-10T02:00:00+02:00",
543534
"hardware": "255",
@@ -573,7 +564,6 @@
573564
"active_preset": "away",
574565
"available": true,
575566
"available_schedules": ["Opstaan weekdag", "Werkdag schema", "Weekend"],
576-
"control_state": "off",
577567
"dev_class": "zone_thermostat",
578568
"firmware": "2016-10-10T02:00:00+02:00",
579569
"hardware": "255",

fixtures/adam_jip/all_data.json

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
"active_preset": "no_frost",
55
"available": true,
66
"available_schedules": ["None"],
7-
"control_state": "off",
87
"dev_class": "zone_thermostat",
98
"firmware": "2016-10-27T02:00:00+02:00",
109
"hardware": "255",
@@ -101,7 +100,6 @@
101100
"active_preset": "home",
102101
"available": true,
103102
"available_schedules": ["None"],
104-
"control_state": "off",
105103
"dev_class": "zone_thermostat",
106104
"firmware": "2016-10-27T02:00:00+02:00",
107105
"hardware": "255",
@@ -159,7 +157,6 @@
159157
"active_preset": "home",
160158
"available": true,
161159
"available_schedules": ["None"],
162-
"control_state": "off",
163160
"dev_class": "zone_thermostat",
164161
"firmware": "2016-10-27T02:00:00+02:00",
165162
"hardware": "255",
@@ -271,7 +268,6 @@
271268
"active_preset": "home",
272269
"available": true,
273270
"available_schedules": ["None"],
274-
"control_state": "off",
275271
"dev_class": "zone_thermometer",
276272
"firmware": "2020-09-01T02:00:00+02:00",
277273
"hardware": "1",

fixtures/adam_onoff_cooling_fake_firmware/all_data.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,6 @@
6464
"ca79d23ae0094120b877558734cff85c": {
6565
"active_preset": "away",
6666
"available_schedules": ["Opstaan weekdag", "Werkdag schema", "Weekend"],
67-
"control_state": "off",
6867
"dev_class": "thermostat",
6968
"last_used": "Werkdag schema",
7069
"location": "fa5fa6b34f6b40a0972988b20e888ed4",

fixtures/adam_plus_anna_new/all_data.json

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,6 @@
127127
"ad4838d7d35c4d6ea796ee12ae5aedf8": {
128128
"active_preset": "asleep",
129129
"available_schedules": ["Weekschema", "Badkamer", "Test"],
130-
"control_state": "heating",
131130
"dev_class": "thermostat",
132131
"last_used": "Weekschema",
133132
"location": "f2bf9048bef64cc5b6d5110154e33c81",
@@ -171,7 +170,6 @@
171170
"active_preset": "home",
172171
"available": true,
173172
"available_schedules": ["Weekschema", "Badkamer", "Test"],
174-
"control_state": "off",
175173
"dev_class": "zone_thermostat",
176174
"firmware": "2016-10-10T02:00:00+02:00",
177175
"hardware": "255",

fixtures/m_adam_cooling/all_data.json

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,15 +88,14 @@
8888
"mac_address": "012345670001",
8989
"model": "Gateway",
9090
"name": "Adam",
91-
"regulation_mode": "cooling",
9291
"regulation_modes": [
9392
"heating",
9493
"off",
9594
"bleeding_cold",
9695
"bleeding_hot",
9796
"cooling"
9897
],
99-
"select_regulation_mode": "heating",
98+
"select_regulation_mode": "cooling",
10099
"sensors": {
101100
"outdoor_temperature": 29.65
102101
},
@@ -107,7 +106,6 @@
107106
"active_preset": "home",
108107
"available": true,
109108
"available_schedules": ["Weekschema", "Badkamer", "Test"],
110-
"control_state": "off",
111109
"dev_class": "zone_thermostat",
112110
"firmware": "2016-10-10T02:00:00+02:00",
113111
"hardware": "255",

fixtures/m_adam_heating/all_data.json

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,6 @@
9191
"mac_address": "012345670001",
9292
"model": "Gateway",
9393
"name": "Adam",
94-
"regulation_mode": "heating",
9594
"regulation_modes": ["heating", "off", "bleeding_cold", "bleeding_hot"],
9695
"select_regulation_mode": "heating",
9796
"sensors": {
@@ -104,7 +103,6 @@
104103
"active_preset": "home",
105104
"available": true,
106105
"available_schedules": ["Weekschema", "Badkamer", "Test"],
107-
"control_state": "off",
108106
"dev_class": "zone_thermostat",
109107
"firmware": "2016-10-10T02:00:00+02:00",
110108
"hardware": "255",

plugwise/__init__.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -222,10 +222,6 @@ def _device_data_climate(
222222
else:
223223
device_data["last_used"] = last_active
224224

225-
# Control_state, only for Adam master thermostats
226-
if ctrl_state := self._control_state(loc_id):
227-
device_data["control_state"] = ctrl_state
228-
229225
# Operation modes: auto, heat, heat_cool
230226
device_data["mode"] = "auto"
231227
if sel_schedule == "None":

plugwise/helper.py

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -743,21 +743,6 @@ def _match_locations(self) -> dict[str, ThermoLoc]:
743743

744744
return matched_locations
745745

746-
def _control_state(self, loc_id: str) -> str | bool:
747-
"""Helper-function for _device_data_adam().
748-
749-
Adam: find the thermostat control_state of a location, from DOMAIN_OBJECTS.
750-
Represents the heating/cooling demand-state of the local master thermostat.
751-
Note: heating or cooling can still be active when the setpoint has been reached.
752-
"""
753-
locator = f'location[@id="{loc_id}"]'
754-
if (location := self._domain_objects.find(locator)) is not None:
755-
locator = './actuator_functionalities/thermostat_functionality[type="thermostat"]/control_state'
756-
if (ctrl_state := location.find(locator)) is not None:
757-
return str(ctrl_state.text)
758-
759-
return False
760-
761746
def _presets_legacy(self) -> dict[str, list[float]]:
762747
"""Helper-function for presets() - collect Presets for a legacy Anna."""
763748
presets: dict[str, list[float]] = {}

tests/test_smile.py

Lines changed: 4 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1769,7 +1769,6 @@ async def test_connect_adam_plus_anna_new(self):
17691769
"available_schedules": ["Weekschema", "Badkamer", "Test"],
17701770
"select_schedule": "Weekschema",
17711771
"last_used": "Weekschema",
1772-
"control_state": "heating",
17731772
"mode": "auto",
17741773
"sensors": {"temperature": 18.1, "setpoint": 18.5},
17751774
},
@@ -1863,7 +1862,6 @@ async def test_connect_adam_plus_anna_new(self):
18631862
"available_schedules": ["Weekschema", "Badkamer", "Test"],
18641863
"select_schedule": "Badkamer",
18651864
"last_used": "Badkamer",
1866-
"control_state": "off",
18671865
"mode": "auto",
18681866
"sensors": {"temperature": 17.9, "setpoint": 15.0, "battery": 56},
18691867
},
@@ -1957,7 +1955,7 @@ async def test_connect_adam_plus_anna_new(self):
19571955

19581956
await self.device_test(smile, "2022-01-16 00:00:01", testdata)
19591957
assert smile.gateway_id == "da224107914542988a88561b4452b0f6"
1960-
assert self.device_items == 147
1958+
assert self.device_items == 145
19611959

19621960
result = await self.tinker_thermostat(
19631961
smile,
@@ -2920,7 +2918,6 @@ async def test_adam_heatpump_cooling(self):
29202918
"active_preset": "away",
29212919
"available": True,
29222920
"available_schedules": ["Opstaan weekdag", "Werkdag schema", "Weekend"],
2923-
"control_state": "off",
29242921
"dev_class": "zone_thermostat",
29252922
"firmware": "2016-10-10T02:00:00+02:00",
29262923
"hardware": "255",
@@ -3019,7 +3016,6 @@ async def test_adam_heatpump_cooling(self):
30193016
"active_preset": "away",
30203017
"available": True,
30213018
"available_schedules": ["Opstaan weekdag", "Werkdag schema", "Weekend"],
3022-
"control_state": "off",
30233019
"dev_class": "zone_thermostat",
30243020
"firmware": "2016-10-10T02:00:00+02:00",
30253021
"hardware": "255",
@@ -3087,7 +3083,6 @@ async def test_adam_heatpump_cooling(self):
30873083
"active_preset": "away",
30883084
"available": True,
30893085
"available_schedules": ["Opstaan weekdag", "Werkdag schema", "Weekend"],
3090-
"control_state": "off",
30913086
"dev_class": "zone_thermostat",
30923087
"firmware": "2016-10-10T02:00:00+02:00",
30933088
"hardware": "255",
@@ -3202,7 +3197,6 @@ async def test_adam_heatpump_cooling(self):
32023197
"active_preset": "away",
32033198
"available": True,
32043199
"available_schedules": ["Opstaan weekdag", "Werkdag schema", "Weekend"],
3205-
"control_state": "off",
32063200
"dev_class": "zone_thermostat",
32073201
"firmware": "2016-10-10T02:00:00+02:00",
32083202
"hardware": "255",
@@ -3232,7 +3226,6 @@ async def test_adam_heatpump_cooling(self):
32323226
"active_preset": "away",
32333227
"available": True,
32343228
"available_schedules": ["Opstaan weekdag", "Werkdag schema", "Weekend"],
3235-
"control_state": "off",
32363229
"dev_class": "zone_thermostat",
32373230
"firmware": "2016-10-10T02:00:00+02:00",
32383231
"hardware": "255",
@@ -3261,7 +3254,6 @@ async def test_adam_heatpump_cooling(self):
32613254
"ca79d23ae0094120b877558734cff85c": {
32623255
"active_preset": "away",
32633256
"available_schedules": ["Opstaan weekdag", "Werkdag schema", "Weekend"],
3264-
"control_state": "off",
32653257
"dev_class": "thermostat",
32663258
"last_used": "Werkdag schema",
32673259
"location": "fa5fa6b34f6b40a0972988b20e888ed4",
@@ -3288,7 +3280,6 @@ async def test_adam_heatpump_cooling(self):
32883280
"active_preset": "away",
32893281
"available": True,
32903282
"available_schedules": ["Opstaan weekdag", "Werkdag schema", "Weekend"],
3291-
"control_state": "off",
32923283
"dev_class": "zone_thermostat",
32933284
"firmware": "2016-10-10T02:00:00+02:00",
32943285
"hardware": "255",
@@ -3318,7 +3309,6 @@ async def test_adam_heatpump_cooling(self):
33183309
"active_preset": "away",
33193310
"available": True,
33203311
"available_schedules": ["Opstaan weekdag", "Werkdag schema", "Weekend"],
3321-
"control_state": "off",
33223312
"dev_class": "zone_thermostat",
33233313
"firmware": "2016-10-10T02:00:00+02:00",
33243314
"hardware": "255",
@@ -3349,7 +3339,6 @@ async def test_adam_heatpump_cooling(self):
33493339
"active_preset": "away",
33503340
"available": True,
33513341
"available_schedules": ["Opstaan weekdag", "Werkdag schema", "Weekend"],
3352-
"control_state": "off",
33533342
"dev_class": "zone_thermostat",
33543343
"firmware": "2016-10-10T02:00:00+02:00",
33553344
"hardware": "255",
@@ -3379,7 +3368,6 @@ async def test_adam_heatpump_cooling(self):
33793368
"active_preset": "away",
33803369
"available": True,
33813370
"available_schedules": ["Opstaan weekdag", "Werkdag schema", "Weekend"],
3382-
"control_state": "off",
33833371
"dev_class": "zone_thermostat",
33843372
"firmware": "2016-10-10T02:00:00+02:00",
33853373
"hardware": "255",
@@ -3411,7 +3399,7 @@ async def test_adam_heatpump_cooling(self):
34113399
server, smile, client = await self.connect_wrapper()
34123400

34133401
await self.device_test(smile, "2022-01-02 00:00:01", testdata)
3414-
assert self.device_items == 443
3402+
assert self.device_items == 433
34153403

34163404
await smile.close_connection()
34173405
await self.disconnect(server, client)
@@ -3474,7 +3462,6 @@ async def test_adam_plus_jip(self):
34743462
"available_schedules": ["None"],
34753463
"select_schedule": "None",
34763464
"last_used": None,
3477-
"control_state": "off",
34783465
"mode": "heat",
34793466
"sensors": {"temperature": 30.0, "setpoint": 13.0, "battery": 80},
34803467
},
@@ -3499,7 +3486,6 @@ async def test_adam_plus_jip(self):
34993486
"available_schedules": ["None"],
35003487
"select_schedule": "None",
35013488
"last_used": None,
3502-
"control_state": "off",
35033489
"mode": "heat",
35043490
"sensors": {"temperature": 24.2, "setpoint": 13.0, "battery": 92},
35053491
},
@@ -3541,7 +3527,6 @@ async def test_adam_plus_jip(self):
35413527
"available_schedules": ["None"],
35423528
"select_schedule": "None",
35433529
"last_used": None,
3544-
"control_state": "off",
35453530
"mode": "heat",
35463531
"sensors": {"temperature": 30.0, "setpoint": 13.0, "battery": 79},
35473532
},
@@ -3566,7 +3551,6 @@ async def test_adam_plus_jip(self):
35663551
"available_schedules": ["None"],
35673552
"select_schedule": "None",
35683553
"last_used": None,
3569-
"control_state": "off",
35703554
"mode": "heat",
35713555
"sensors": {
35723556
"temperature": 27.4,
@@ -3659,7 +3643,7 @@ async def test_adam_plus_jip(self):
36593643

36603644
await self.device_test(smile, "2021-06-20 00:00:01", testdata)
36613645
assert smile.gateway_id == "b5c2386c6f6342669e50fe49dd05b188"
3662-
assert self.device_items == 223
3646+
assert self.device_items == 219
36633647

36643648
# Negative test
36653649
result = await self.tinker_thermostat(
@@ -4218,7 +4202,7 @@ async def test_connect_adam_onoff_cooling_fake_firmware(self):
42184202
assert smile.smile_type == "thermostat"
42194203

42204204
await self.device_test(smile, "2022-01-02 00:00:01", testdata)
4221-
assert self.device_items == 57
4205+
assert self.device_items == 56
42224206
assert smile._cooling_present
42234207
assert smile._cooling_enabled
42244208

0 commit comments

Comments
 (0)