Skip to content

Commit a671852

Browse files
authored
Merge pull request #143 from plugwise/add_binary_sensors
Add cooling_state and heating_state to binary_sensors-dict
2 parents ee22d23 + 7b369d4 commit a671852

File tree

2 files changed

+35
-26
lines changed

2 files changed

+35
-26
lines changed

plugwise/constants.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -546,14 +546,18 @@
546546
SWITCH_ICON = "mdi:electric-switch"
547547

548548
# Binary Sensors
549+
COOLING_STATE = {"cooling_state": False}
549550
DHW_STATE = {"dhw_state": False}
550551
FLAME_STATE = {"flame_state": False}
552+
HEATING_STATE = {"heating_state": False}
551553
PW_NOTIFICATION = {"plugwise_notification": False}
552554
SLAVE_BOILER_STATE = {"slave_boiler_state": False}
553555

554556
BINARY_SENSORS = [
557+
COOLING_STATE,
555558
DHW_STATE,
556559
FLAME_STATE,
560+
HEATING_STATE,
557561
SLAVE_BOILER_STATE,
558562
]
559563

tests/test_smile.py

Lines changed: 31 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -610,9 +610,8 @@ async def test_connect_legacy_anna(self):
610610
"model": "4.21",
611611
"name": "OpenTherm",
612612
"vendor": "Bosch Thermotechniek B.V.",
613-
"heating_state": True,
614613
"cooling_active": False,
615-
"binary_sensors": {"flame_state": True},
614+
"binary_sensors": {"flame_state": True, "heating_state": True},
616615
"sensors": {
617616
"water_temperature": 23.6,
618617
"intended_boiler_temperature": 17.0,
@@ -715,9 +714,8 @@ async def test_connect_legacy_anna_2(self):
715714
"model": "Generic heater",
716715
"name": "OpenTherm",
717716
"vendor": None,
718-
"heating_state": False,
719717
"cooling_active": False,
720-
"binary_sensors": {"flame_state": False},
718+
"binary_sensors": {"flame_state": False, "heating_state": False},
721719
"sensors": {
722720
"water_temperature": 54.0,
723721
"intended_boiler_temperature": 0.0,
@@ -907,9 +905,12 @@ async def test_connect_anna_v4(self):
907905
"model": "2.32",
908906
"name": "OpenTherm",
909907
"vendor": "Bosch Thermotechniek B.V.",
910-
"heating_state": True,
911908
"cooling_active": False,
912-
"binary_sensors": {"dhw_state": False, "flame_state": True},
909+
"binary_sensors": {
910+
"dhw_state": False,
911+
"flame_state": True,
912+
"heating_state": True,
913+
},
913914
"sensors": {
914915
"water_temperature": 52.0,
915916
"intended_boiler_temperature": 48.6,
@@ -1127,8 +1128,8 @@ async def test_connect_anna_without_boiler_fw42(self):
11271128
"model": "Unknown",
11281129
"name": "OnOff",
11291130
"vendor": None,
1130-
"heating_state": True,
11311131
"cooling_active": False,
1132+
"binary_sensors": {"heating_state": True},
11321133
},
11331134
# Anna
11341135
"7ffbb3ab4b6c4ab2915d7510f7bf8fe9": {
@@ -1220,8 +1221,7 @@ async def test_connect_adam_plus_anna(self):
12201221
},
12211222
# Central
12221223
"2743216f626f43948deec1f7ab3b3d70": {
1223-
"binary_sensors": {"flame_state": False},
1224-
"heating_state": False,
1224+
"binary_sensors": {"flame_state": False, "heating_state": False},
12251225
},
12261226
# Plug MediaCenter
12271227
"aa6b0002df0a46e1b1eb94beb61eddfe": {
@@ -1413,10 +1413,13 @@ async def test_connect_adam_plus_anna_new(self):
14131413
"model": "Generic heater",
14141414
"name": "OpenTherm",
14151415
"vendor": None,
1416-
"heating_state": True,
1417-
"cooling_state": False,
14181416
"cooling_active": False,
1419-
"binary_sensors": {"dhw_state": False, "flame_state": False},
1417+
"binary_sensors": {
1418+
"cooling_state": False,
1419+
"dhw_state": False,
1420+
"flame_state": False,
1421+
"heating_state": True,
1422+
},
14201423
"sensors": {
14211424
"water_temperature": 37.0,
14221425
"intended_boiler_temperature": 38.1,
@@ -1483,8 +1486,7 @@ async def test_connect_adam_plus_anna_new_copy_dhw_and_heating(self):
14831486
testdata = {
14841487
# Central
14851488
"2743216f626f43948deec1f7ab3b3d70": {
1486-
"binary_sensors": {"dhw_state": True},
1487-
"heating_state": True,
1489+
"binary_sensors": {"dhw_state": True, "heating_state": True},
14881490
},
14891491
# Lisa Badkamer
14901492
"453e510de7cb47af8ec5b44fbf40cbe5": {
@@ -1506,7 +1508,7 @@ async def test_connect_adam_plus_anna_new_copy_cooling(self):
15061508
testdata = {
15071509
# Central
15081510
"2743216f626f43948deec1f7ab3b3d70": {
1509-
"cooling_state": True,
1511+
"binary_sensors": {"cooling_state": True},
15101512
},
15111513
}
15121514

@@ -1524,8 +1526,7 @@ async def test_connect_adam_plus_anna_new_copy_dhw_and_cooling(self):
15241526
testdata = {
15251527
# Central
15261528
"2743216f626f43948deec1f7ab3b3d70": {
1527-
"binary_sensors": {"dhw_state": True},
1528-
"cooling_state": True,
1529+
"binary_sensors": {"cooling_state": True, "dhw_state": True},
15291530
}
15301531
}
15311532

@@ -1542,7 +1543,7 @@ async def test_connect_adam_zone_per_device(self):
15421543
"""Test a broad setup of Adam with a zone per device setup."""
15431544
testdata = {
15441545
"90986d591dcd426cae3ec3e8111ff730": {
1545-
"heating_state": False,
1546+
"binary_sensors": {"heating_state": False},
15461547
},
15471548
# Lisa WK
15481549
"b59bcebaf94b499ea7d46e4a66fb62d8": {
@@ -1801,7 +1802,7 @@ async def test_connect_adam_multiple_devices_per_zone(self):
18011802
"name": "OnOff",
18021803
"vendor": None,
18031804
"cooling_active": False,
1804-
"heating_state": True,
1805+
"binary_sensors": {"heating_state": True},
18051806
"sensors": {
18061807
"water_temperature": 70.0,
18071808
"intended_boiler_temperature": 70.0,
@@ -2223,9 +2224,11 @@ async def test_connect_anna_heatpump(self):
22232224
# Heater central
22242225
"1cbf783bb11e4a7c8a6843dee3a86927": {
22252226
"cooling_active": False,
2226-
"cooling_state": False,
2227-
"heating_state": True,
2228-
"binary_sensors": {"dhw_state": False},
2227+
"binary_sensors": {
2228+
"cooling_state": False,
2229+
"dhw_state": False,
2230+
"heating_state": True,
2231+
},
22292232
"sensors": {
22302233
"outdoor_temperature": 3.0,
22312234
"water_temperature": 29.1,
@@ -2279,9 +2282,11 @@ async def test_connect_anna_heatpump_cooling(self):
22792282
# Heater central
22802283
"1cbf783bb11e4a7c8a6843dee3a86927": {
22812284
"cooling_active": True,
2282-
"cooling_state": True,
2283-
"heating_state": False,
2284-
"binary_sensors": {"dhw_state": False},
2285+
"binary_sensors": {
2286+
"cooling_state": True,
2287+
"dhw_state": False,
2288+
"heating_state": False,
2289+
},
22852290
"sensors": {
22862291
"outdoor_temperature": 22.0,
22872292
"water_temperature": 24.7,
@@ -2323,7 +2328,7 @@ async def test_connect_adam_plus_anna_copy_with_error_domain_added(self):
23232328
testdata = {
23242329
# Central
23252330
"2743216f626f43948deec1f7ab3b3d70": {
2326-
"heating_state": False,
2331+
"binary_sensors": {"heating_state": False},
23272332
},
23282333
}
23292334

0 commit comments

Comments
 (0)