File: climate_test.py

package info (click to toggle)
python-xknx 3.10.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 4,044 kB
  • sloc: python: 40,087; javascript: 8,556; makefile: 32; sh: 12
file content (1777 lines) | stat: -rw-r--r-- 68,553 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
"""Unit test for Climate objects."""

from typing import Any
from unittest.mock import Mock, patch

import pytest

from xknx import XKNX
from xknx.devices import Climate, ClimateMode
from xknx.devices.climate import FanSpeedMode, SetpointShiftMode
from xknx.dpt import (
    DPT2ByteFloat,
    DPTArray,
    DPTBinary,
    DPTHumidity,
    DPTHVACContrMode,
    DPTHVACMode,
    DPTHVACStatus,
    DPTTemperature,
    DPTValue1Count,
)
from xknx.dpt.dpt_20 import HVACControllerMode, HVACOperationMode, HVACStatus
from xknx.exceptions import ConversionError, DeviceIllegalValue
from xknx.telegram import GroupAddress, Telegram
from xknx.telegram.apci import GroupValueRead, GroupValueWrite

DPT_20102_MODES = [
    HVACOperationMode.AUTO,
    HVACOperationMode.COMFORT,
    HVACOperationMode.STANDBY,
    HVACOperationMode.ECONOMY,
    HVACOperationMode.BUILDING_PROTECTION,
]


class TestClimate:
    """Test class for Climate objects."""

    #
    # SUPPORTS TEMPERATURE / SETPOINT
    #
    def test_support_temperature(self) -> None:
        """Test supports_temperature flag."""
        xknx = XKNX()
        climate = Climate(xknx, "TestClimate", group_address_temperature="1/2/3")

        assert climate.temperature.initialized
        assert not climate.target_temperature.initialized

    def test_support_target_temperature(self) -> None:
        """Test supports_target__temperature flag."""
        xknx = XKNX()
        climate = Climate(xknx, "TestClimate", group_address_target_temperature="1/2/3")

        assert not climate.temperature.initialized
        assert climate.target_temperature.initialized

    def test_support_operation_mode(self) -> None:
        """Test supports_supports_operation_mode flag. One group address for all modes."""
        xknx = XKNX()
        climate_mode = ClimateMode(
            xknx, "TestClimate", group_address_operation_mode="1/2/4"
        )
        assert climate_mode.supports_operation_mode

    def test_support_operation_mode2(self) -> None:
        """Test supports_supports_operation_mode flag. Split group addresses for each mode."""
        xknx = XKNX()
        climate_mode = ClimateMode(
            xknx, "TestClimate", group_address_operation_mode_protection="1/2/4"
        )
        assert climate_mode.supports_operation_mode

    @pytest.mark.parametrize(
        ("address", "state", "expected"),
        [
            ("1/2/4", None, True),
            (None, "1/2/5", True),
            (None, None, False),
            ([], [], False),
        ],
    )
    def test_supports_on_off(self, address: Any, state: Any, expected: bool) -> None:
        """Test supports_on_off flag."""
        xknx = XKNX()
        climate = Climate(
            xknx,
            "TestClimate",
            group_address_on_off=address,
            group_address_on_off_state=state,
        )
        assert climate.supports_on_off == expected

    #
    # TEST HAS GROUP ADDRESS
    #
    def test_has_group_address(self) -> None:
        """Test if has_group_address function works."""
        xknx = XKNX()
        climate = Climate(
            xknx,
            "TestClimate",
            group_address_temperature="1/2/1",
            group_address_target_temperature="1/2/2",
            group_address_setpoint_shift="1/2/3",
            group_address_setpoint_shift_state="1/2/4",
            group_address_on_off="1/2/11",
            group_address_on_off_state="1/2/12",
            group_address_humidity_state="1/2/16",
        )

        assert climate.has_group_address(GroupAddress("1/2/1"))
        assert climate.has_group_address(GroupAddress("1/2/2"))
        assert climate.has_group_address(GroupAddress("1/2/4"))
        assert climate.has_group_address(GroupAddress("1/2/11"))
        assert climate.has_group_address(GroupAddress("1/2/12"))
        assert climate.has_group_address(GroupAddress("1/2/16"))
        assert not climate.has_group_address(GroupAddress("1/2/99"))

        assert climate.group_addresses() == {
            GroupAddress("1/2/1"),
            GroupAddress("1/2/2"),
            GroupAddress("1/2/3"),
            GroupAddress("1/2/4"),
            GroupAddress("1/2/11"),
            GroupAddress("1/2/12"),
            GroupAddress("1/2/16"),
        }

    #
    # TEST HAS GROUP ADDRESS
    #
    def test_has_group_address_mode(self) -> None:
        """Test if has_group_address function works."""
        xknx = XKNX()
        climate_mode = ClimateMode(
            xknx,
            name=None,
            group_address_operation_mode="1/2/4",
            group_address_operation_mode_state="1/2/5",
            group_address_operation_mode_protection="1/2/6",
            group_address_operation_mode_economy="1/2/7",
            group_address_operation_mode_comfort="1/2/8",
            group_address_operation_mode_standby="1/2/9",
            group_address_controller_status="1/2/10",
            group_address_controller_status_state="1/2/11",
            group_address_controller_mode="1/2/12",
            group_address_controller_mode_state="1/2/13",
            group_address_heat_cool="1/2/14",
            group_address_heat_cool_state="1/2/15",
        )

        climate = Climate(xknx, name="TestClimate", mode=climate_mode)

        assert climate.has_group_address(GroupAddress("1/2/4"))
        assert climate.has_group_address(GroupAddress("1/2/5"))
        assert climate.has_group_address(GroupAddress("1/2/6"))
        assert climate.has_group_address(GroupAddress("1/2/7"))
        assert climate.has_group_address(GroupAddress("1/2/8"))
        assert climate.has_group_address(GroupAddress("1/2/9"))
        assert climate.has_group_address(GroupAddress("1/2/10"))
        assert climate.has_group_address(GroupAddress("1/2/11"))
        assert climate.has_group_address(GroupAddress("1/2/12"))
        assert climate.has_group_address(GroupAddress("1/2/13"))
        assert climate.has_group_address(GroupAddress("1/2/14"))
        assert climate.has_group_address(GroupAddress("1/2/15"))
        assert not climate.has_group_address(GroupAddress("1/2/99"))

        assert climate.group_addresses() == {
            GroupAddress("1/2/4"),
            GroupAddress("1/2/5"),
            GroupAddress("1/2/6"),
            GroupAddress("1/2/7"),
            GroupAddress("1/2/8"),
            GroupAddress("1/2/9"),
            GroupAddress("1/2/10"),
            GroupAddress("1/2/11"),
            GroupAddress("1/2/12"),
            GroupAddress("1/2/13"),
            GroupAddress("1/2/14"),
            GroupAddress("1/2/15"),
        }

    #
    # TEST CALLBACK
    #
    async def test_process_callback(self) -> None:
        """Test if after_update_callback is called after update of Climate object was changed."""

        xknx = XKNX()
        climate = Climate(
            xknx,
            "TestClimate",
            group_address_target_temperature="1/2/2",
            group_address_setpoint_shift="1/2/3",
            group_address_setpoint_shift_state="1/2/4",
            setpoint_shift_mode=SetpointShiftMode.DPT6010,
        )
        after_update_callback = Mock()
        climate.register_device_updated_cb(after_update_callback)
        xknx.devices.async_add(climate)

        climate.target_temperature.set(23.00)
        xknx.devices.process(xknx.telegrams.get_nowait())
        after_update_callback.assert_called_with(climate)
        after_update_callback.reset_mock()

        await climate.set_setpoint_shift(-2)
        xknx.devices.process(xknx.telegrams.get_nowait())
        after_update_callback.assert_called_with(climate)
        after_update_callback.reset_mock()

    async def test_process_callback_mode(self) -> None:
        """Test if after_update_callback is called after update of Climate object was changed."""

        xknx = XKNX()
        after_update_callback = Mock()
        climate_mode = ClimateMode(
            xknx,
            "TestClimate",
            group_address_operation_mode="1/2/5",
            device_updated_cb=after_update_callback,
        )

        await climate_mode.set_operation_mode(HVACOperationMode.COMFORT)
        after_update_callback.assert_called_with(climate_mode)
        after_update_callback.reset_mock()

        await climate_mode.set_operation_mode(HVACOperationMode.COMFORT)
        after_update_callback.assert_not_called()
        after_update_callback.reset_mock()

        await climate_mode.set_operation_mode(HVACOperationMode.BUILDING_PROTECTION)
        after_update_callback.assert_called_with(climate_mode)
        after_update_callback.reset_mock()

    async def test_process_callback_updated_via_telegram(self) -> None:
        """Test if after_update_callback is called after update of Climate object."""

        xknx = XKNX()
        climate = Climate(
            xknx,
            "TestClimate",
            group_address_temperature="1/2/1",
            group_address_target_temperature="1/2/2",
            group_address_setpoint_shift="1/2/3",
        )
        after_update_callback = Mock()
        climate.register_device_updated_cb(after_update_callback)

        telegram = Telegram(
            destination_address=GroupAddress("1/2/1"),
            payload=GroupValueWrite(DPTTemperature.to_knx(23)),
        )
        climate.process(telegram)
        after_update_callback.assert_called_with(climate)
        after_update_callback.reset_mock()

        telegram = Telegram(
            destination_address=GroupAddress("1/2/2"),
            payload=GroupValueWrite(DPTTemperature.to_knx(23)),
        )
        climate.process(telegram)
        after_update_callback.assert_called_with(climate)
        after_update_callback.reset_mock()

        telegram = Telegram(
            destination_address=GroupAddress("1/2/3"),
            payload=GroupValueWrite(DPTValue1Count.to_knx(-4)),
        )
        climate.process(telegram)
        after_update_callback.assert_called_with(climate)
        after_update_callback.reset_mock()

    async def test_climate_mode_process_callback_updated_via_telegram(self) -> None:
        """Test if after_update_callback is called after update of ClimateMode object."""

        xknx = XKNX()
        climate_mode = ClimateMode(
            xknx, "TestClimateMode", group_address_operation_mode="1/2/4"
        )
        after_update_callback = Mock()

        climate = Climate(xknx, "TestClimate", mode=climate_mode)
        climate_mode.register_device_updated_cb(after_update_callback)

        # Note: the climate object processes the telegram, but the cb
        # is called with the climate_mode object.
        telegram = Telegram(
            destination_address=GroupAddress("1/2/4"),
            payload=GroupValueWrite(DPTArray(1)),
        )
        climate.process(telegram)
        after_update_callback.assert_called_with(climate_mode)
        after_update_callback.reset_mock()

    #
    # TEST SET OPERATION MODE
    #
    async def test_set_operation_mode(self) -> None:
        """Test set_operation_mode."""
        xknx = XKNX()
        climate_mode = ClimateMode(
            xknx, "TestClimate", group_address_operation_mode="1/2/4"
        )

        for operation_mode in DPT_20102_MODES:
            await climate_mode.set_operation_mode(operation_mode)
            assert xknx.telegrams.qsize() == 1
            telegram = xknx.telegrams.get_nowait()
            assert telegram == Telegram(
                destination_address=GroupAddress("1/2/4"),
                payload=GroupValueWrite(DPTHVACMode.to_knx(operation_mode)),
            )

    async def test_set_controller_operation_mode(self) -> None:
        """Test set_operation_mode with DPT20.105 controller."""
        xknx = XKNX()
        climate_mode = ClimateMode(
            xknx, "TestClimate", group_address_controller_mode="1/2/4"
        )

        for controller_mode in DPTHVACContrMode.get_valid_values():
            await climate_mode.set_controller_mode(controller_mode)
            assert xknx.telegrams.qsize() == 1
            telegram = xknx.telegrams.get_nowait()
            assert telegram == Telegram(
                destination_address=GroupAddress("1/2/4"),
                payload=GroupValueWrite(DPTHVACContrMode.to_knx(controller_mode)),
            )

    async def test_set_operation_mode_not_supported(self) -> None:
        """Test set_operation_mode but not supported."""
        xknx = XKNX()
        climate_mode = ClimateMode(xknx, "TestClimate")
        with pytest.raises(DeviceIllegalValue):
            await climate_mode.set_operation_mode(HVACOperationMode.AUTO)

    async def test_set_controller_mode_not_supported(self) -> None:
        """Test set_controller_mode but not supported."""
        xknx = XKNX()
        climate_mode = ClimateMode(xknx, "TestClimate")
        with pytest.raises(DeviceIllegalValue):
            await climate_mode.set_controller_mode(HVACControllerMode.HEAT)

    async def test_set_operation_mode_with_controller_status(self) -> None:
        """Test set_operation_mode with controller status address defined."""
        xknx = XKNX()
        climate_mode = ClimateMode(
            xknx, "TestClimate", group_address_controller_status="1/2/4"
        )

        # needs to be initialized before it can be sent
        with pytest.raises(ConversionError):
            await climate_mode.set_controller_mode(HVACControllerMode.HEAT)

        climate_mode.process(
            Telegram(
                destination_address=GroupAddress("1/2/4"),
                payload=GroupValueWrite(DPTArray((0x01,))),
            )
        )
        assert climate_mode.controller_mode == HVACControllerMode.COOL
        assert climate_mode.operation_mode == HVACOperationMode.COMFORT

        # controller mode
        await climate_mode.set_controller_mode(HVACControllerMode.HEAT)
        assert xknx.telegrams.qsize() == 1
        telegram = xknx.telegrams.get_nowait()
        assert telegram == Telegram(
            destination_address=GroupAddress("1/2/4"),
            payload=GroupValueWrite(DPTArray((0x21,))),
        )
        climate_mode.process(telegram)  # process to have internal value updated
        # operation mode
        await climate_mode.set_operation_mode(HVACOperationMode.STANDBY)
        assert xknx.telegrams.qsize() == 1
        telegram = xknx.telegrams.get_nowait()
        assert telegram == Telegram(
            destination_address=GroupAddress("1/2/4"),
            payload=GroupValueWrite(DPTArray((0x22,))),
        )

    async def test_set_operation_mode_with_separate_addresses(self) -> None:
        """Test set_operation_mode with combined and separated group addresses defined."""
        xknx = XKNX()
        climate_mode = ClimateMode(
            xknx,
            "TestClimate",
            group_address_operation_mode="1/2/4",
            group_address_operation_mode_protection="1/2/5",
            group_address_operation_mode_economy="1/2/6",
            group_address_operation_mode_comfort="1/2/7",
        )

        await climate_mode.set_operation_mode(HVACOperationMode.COMFORT)
        assert xknx.telegrams.qsize() == 4
        telegrams = [xknx.telegrams.get_nowait() for _ in range(4)]
        test_telegrams = [
            Telegram(
                destination_address=GroupAddress("1/2/4"),
                payload=GroupValueWrite(DPTArray(1)),
            ),
            Telegram(
                destination_address=GroupAddress("1/2/5"),
                payload=GroupValueWrite(DPTBinary(False)),
            ),
            Telegram(
                destination_address=GroupAddress("1/2/6"),
                payload=GroupValueWrite(DPTBinary(False)),
            ),
            Telegram(
                destination_address=GroupAddress("1/2/7"),
                payload=GroupValueWrite(DPTBinary(True)),
            ),
        ]

        for test_item in test_telegrams:
            assert test_item in telegrams

    async def test_set_heat_cool_binary(self) -> None:
        """Test set_operation_mode with binary heat/cool group addresses defined."""
        xknx = XKNX()
        climate_mode = ClimateMode(
            xknx,
            "TestClimate",
            group_address_heat_cool="1/2/14",
            group_address_heat_cool_state="1/2/15",
        )

        await climate_mode.set_controller_mode(HVACControllerMode.HEAT)
        assert xknx.telegrams.qsize() == 1
        telegram = xknx.telegrams.get_nowait()
        assert telegram == Telegram(
            destination_address=GroupAddress("1/2/14"),
            payload=GroupValueWrite(DPTBinary(True)),
        )

        await climate_mode.set_controller_mode(HVACControllerMode.COOL)
        assert xknx.telegrams.qsize() == 1
        telegram = xknx.telegrams.get_nowait()
        assert telegram == Telegram(
            destination_address=GroupAddress("1/2/14"),
            payload=GroupValueWrite(DPTBinary(False)),
        )

    async def test_set_multiple_mode(self) -> None:
        """Test if set operation or controller mode with multiple mode types."""

        xknx = XKNX()
        climate_mode = ClimateMode(
            xknx,
            name=None,
            group_address_operation_mode="1/2/4",
            group_address_operation_mode_state="1/2/5",
            group_address_operation_mode_protection="1/2/6",
            group_address_operation_mode_economy="1/2/7",
            group_address_operation_mode_comfort="1/2/8",
            group_address_operation_mode_standby="1/2/9",
            group_address_controller_status="1/2/10",
            group_address_controller_status_state="1/2/11",
            group_address_controller_mode="1/2/12",
            group_address_controller_mode_state="1/2/13",
            group_address_heat_cool="1/2/14",
            group_address_heat_cool_state="1/2/15",
        )

        def _process_all_telegrams() -> None:
            """Process all telegrams in the queue in ClimateMode device."""
            for _ in range(xknx.telegrams.qsize()):
                telegram = xknx.telegrams.get_nowait()
                climate_mode.process(telegram)

        # HVACStatus needs to be initialized before it can be sent
        climate_mode.process(
            Telegram(
                destination_address=GroupAddress("1/2/10"),
                payload=GroupValueWrite(DPTArray((0b10000000,))),
            )
        )
        await climate_mode.set_controller_mode(HVACControllerMode.HEAT)
        assert xknx.telegrams.qsize() == 3
        _process_all_telegrams()

        await climate_mode.set_operation_mode(HVACOperationMode.COMFORT)
        assert xknx.telegrams.qsize() == 6
        _process_all_telegrams()

        await climate_mode.set_controller_mode(HVACControllerMode.NODEM)
        assert xknx.telegrams.qsize() == 1  # only supported by controller mode
        _process_all_telegrams()
        assert climate_mode.operation_mode == HVACOperationMode.COMFORT
        assert climate_mode.controller_mode == HVACControllerMode.NODEM

        await climate_mode.set_controller_mode(HVACControllerMode.COOL)
        assert xknx.telegrams.qsize() == 3
        _process_all_telegrams()

        await climate_mode.set_operation_mode(HVACOperationMode.ECONOMY)
        assert xknx.telegrams.qsize() == 6
        _process_all_telegrams()
        assert climate_mode.operation_mode == HVACOperationMode.ECONOMY
        assert climate_mode.controller_mode == HVACControllerMode.COOL

    #
    # TEST initialized_for_setpoint_shift_calculations
    #
    async def test_initialized_for_setpoint_shift_calculations(self) -> None:
        """Test initialized_for_setpoint_shift_calculations method."""
        xknx = XKNX()
        climate1 = Climate(xknx, "TestClimate")
        xknx.devices.async_add(climate1)
        assert not climate1.initialized_for_setpoint_shift_calculations

        climate2 = Climate(
            xknx,
            "TestClimate",
            group_address_setpoint_shift="1/2/3",
            setpoint_shift_mode=SetpointShiftMode.DPT6010,
        )
        xknx.devices.async_add(climate2)
        assert not climate2.initialized_for_setpoint_shift_calculations
        await climate2.set_setpoint_shift(4)
        xknx.devices.process(xknx.telegrams.get_nowait())
        assert not climate2.initialized_for_setpoint_shift_calculations

        climate3 = Climate(
            xknx,
            "TestClimate",
            group_address_target_temperature="1/2/2",
            group_address_setpoint_shift="1/2/3",
            setpoint_shift_mode=SetpointShiftMode.DPT6010,
        )
        xknx.devices.async_add(climate3)
        await climate3.set_setpoint_shift(4)
        xknx.devices.process(xknx.telegrams.get_nowait())
        assert not climate3.initialized_for_setpoint_shift_calculations

        climate3.target_temperature.set(23.00)
        xknx.devices.process(xknx.telegrams.get_nowait())
        assert climate3.initialized_for_setpoint_shift_calculations

    async def test_setpoint_shift_mode_autosensing(self) -> None:
        """Test autosensing setpoint_shift_mode."""

        xknx = XKNX()
        climate_dpt6 = Climate(
            xknx,
            "TestClimate",
            group_address_temperature="1/2/1",
            group_address_target_temperature_state="1/2/2",
            group_address_setpoint_shift="1/2/3",
        )
        climate_dpt6.target_temperature.value = 23.00

        # uninitialized
        with pytest.raises(ConversionError):
            await climate_dpt6.set_setpoint_shift(1)

        telegram = Telegram(
            destination_address=GroupAddress("1/2/3"),
            payload=GroupValueWrite(DPTValue1Count.to_knx(-4)),
        )
        climate_dpt6.process(telegram)
        assert climate_dpt6.initialized_for_setpoint_shift_calculations

        await climate_dpt6.set_setpoint_shift(1)
        _telegram = xknx.telegrams.get_nowait()
        # DPTValue1Count is used for outgoing
        assert _telegram == Telegram(
            destination_address=GroupAddress("1/2/3"),
            payload=GroupValueWrite(DPTArray(10)),  # 1 / 0.1 setpoint_shift_step
        )

        climate_dpt9 = Climate(
            xknx,
            "TestClimate",
            group_address_temperature="1/2/1",
            group_address_target_temperature_state="1/2/2",
            group_address_setpoint_shift="1/2/3",
        )
        climate_dpt9.target_temperature.value = 23.00

        # uninitialized
        with pytest.raises(ConversionError):
            await climate_dpt9.set_setpoint_shift(1)

        telegram = Telegram(
            destination_address=GroupAddress("1/2/3"),
            payload=GroupValueWrite(DPTTemperature.to_knx(-4)),
        )
        climate_dpt9.process(telegram)
        assert climate_dpt9.initialized_for_setpoint_shift_calculations

        await climate_dpt9.set_setpoint_shift(1)
        _telegram = xknx.telegrams.get_nowait()
        # DPTTemperature is used for outgoing
        assert _telegram == Telegram(
            destination_address=GroupAddress("1/2/3"),
            payload=GroupValueWrite(DPTTemperature.to_knx(1)),
        )

    #
    # TEST for uninitialized target_temperature_min/target_temperature_max
    #
    def test_uninitalized_for_target_temperature_min_max(self) -> None:
        """Test if target_temperature_min/target_temperature_max return non if not initialized."""
        xknx = XKNX()
        climate = Climate(xknx, "TestClimate")
        assert climate.target_temperature_min is None
        assert climate.target_temperature_max is None

    #
    # TEST for uninitialized target_temperature_min/target_temperature_max but with overridden max and min temperature
    #
    def test_uninitalized_for_target_temperature_min_max_can_be_overridden(
        self,
    ) -> None:
        """Test if target_temperature_min/target_temperature_max return overridden value if specified."""
        xknx = XKNX()
        climate = Climate(xknx, "TestClimate", min_temp="7", max_temp="35")
        assert climate.target_temperature_min == "7"
        assert climate.target_temperature_max == "35"

    #
    # TEST for overridden max and min temp do have precedence over setpoint shift calculations
    #
    async def test_overridden_max_min_temperature_has_priority(self) -> None:
        """Test that the overridden min and max temp always have precedence over setpoint shift calculations."""
        xknx = XKNX()
        climate = Climate(
            xknx,
            "TestClimate",
            group_address_target_temperature="1/2/2",
            group_address_setpoint_shift="1/2/3",
            setpoint_shift_mode=SetpointShiftMode.DPT6010,
            max_temp="42",
            min_temp="3",
        )
        xknx.devices.async_add(climate)

        await climate.set_setpoint_shift(4)
        xknx.devices.process(xknx.telegrams.get_nowait())
        assert not climate.initialized_for_setpoint_shift_calculations

        climate.target_temperature.set(23.00)
        xknx.devices.process(xknx.telegrams.get_nowait())
        assert climate.initialized_for_setpoint_shift_calculations
        assert climate.target_temperature_min == "3"
        assert climate.target_temperature_max == "42"

    #
    # TEST TARGET TEMPERATURE
    #
    async def test_target_temperature_up(self) -> None:
        """Test increase target temperature."""

        xknx = XKNX()
        climate = Climate(
            xknx,
            "TestClimate",
            group_address_target_temperature="1/2/2",
            group_address_setpoint_shift="1/2/3",
            setpoint_shift_mode=SetpointShiftMode.DPT6010,
        )
        xknx.devices.async_add(climate)

        await climate.set_setpoint_shift(3)
        assert xknx.telegrams.qsize() == 1
        _telegram = xknx.telegrams.get_nowait()
        # DEFAULT_TEMPERATURE_STEP is 0.1 -> payload = setpoint_shift * 10
        assert _telegram == Telegram(
            destination_address=GroupAddress("1/2/3"),
            payload=GroupValueWrite(DPTArray(30)),
        )
        xknx.devices.process(_telegram)

        climate.target_temperature.set(23.00)
        assert xknx.telegrams.qsize() == 1
        _telegram = xknx.telegrams.get_nowait()
        assert _telegram == Telegram(
            destination_address=GroupAddress("1/2/2"),
            payload=GroupValueWrite(DPT2ByteFloat().to_knx(23.00)),
        )
        xknx.devices.process(_telegram)
        assert climate.base_temperature == 20

        # First change
        await climate.set_target_temperature(24.00)
        assert xknx.telegrams.qsize() == 2
        _telegram = xknx.telegrams.get_nowait()
        assert _telegram == Telegram(
            destination_address=GroupAddress("1/2/3"),
            payload=GroupValueWrite(DPTArray(40)),
        )
        xknx.devices.process(_telegram)
        _telegram = xknx.telegrams.get_nowait()
        assert _telegram == Telegram(
            destination_address=GroupAddress("1/2/2"),
            payload=GroupValueWrite(DPT2ByteFloat().to_knx(24.00)),
        )
        xknx.devices.process(_telegram)
        assert climate.target_temperature.value == 24.00

        # Second change
        await climate.set_target_temperature(23.50)
        assert xknx.telegrams.qsize() == 2
        _telegram = xknx.telegrams.get_nowait()
        assert _telegram == Telegram(
            destination_address=GroupAddress("1/2/3"),
            payload=GroupValueWrite(DPTArray(35)),
        )
        xknx.devices.process(_telegram)
        _telegram = xknx.telegrams.get_nowait()
        assert _telegram == Telegram(
            destination_address=GroupAddress("1/2/2"),
            payload=GroupValueWrite(DPT2ByteFloat().to_knx(23.50)),
        )
        xknx.devices.process(_telegram)
        assert climate.target_temperature.value == 23.50

        # Test max target temperature
        # Base (20) - setpoint_shift_max (6)
        assert climate.target_temperature_max == 26.00

        # third change - limit exceeded, setting to max
        await climate.set_target_temperature(26.50)
        assert xknx.telegrams.qsize() == 2
        xknx.devices.process(xknx.telegrams.get_nowait())
        xknx.devices.process(xknx.telegrams.get_nowait())
        assert climate.target_temperature_max == 26.00
        assert climate.setpoint_shift == 6

    async def test_target_temperature_down(self) -> None:
        """Test decrease target temperature."""

        xknx = XKNX()
        climate = Climate(
            xknx,
            "TestClimate",
            group_address_target_temperature="1/2/2",
            group_address_setpoint_shift="1/2/3",
            setpoint_shift_mode=SetpointShiftMode.DPT6010,
        )
        xknx.devices.async_add(climate)

        await climate.set_setpoint_shift(1)
        assert xknx.telegrams.qsize() == 1
        _telegram = xknx.telegrams.get_nowait()
        # DEFAULT_TEMPERATURE_STEP is 0.1 -> payload = setpoint_shift * 10
        assert _telegram == Telegram(
            destination_address=GroupAddress("1/2/3"),
            payload=GroupValueWrite(DPTArray(10)),
        )
        xknx.devices.process(_telegram)

        climate.target_temperature.set(23.00)
        assert xknx.telegrams.qsize() == 1
        _telegram = xknx.telegrams.get_nowait()
        assert _telegram == Telegram(
            destination_address=GroupAddress("1/2/2"),
            payload=GroupValueWrite(DPT2ByteFloat().to_knx(23.00)),
        )
        xknx.devices.process(_telegram)
        assert climate.base_temperature == 22.0

        # First change
        await climate.set_target_temperature(20.50)
        assert xknx.telegrams.qsize() == 2
        _telegram = xknx.telegrams.get_nowait()
        assert _telegram == Telegram(
            destination_address=GroupAddress("1/2/3"),
            payload=GroupValueWrite(DPTArray(0xF1)),
        )  # -15
        xknx.devices.process(_telegram)
        _telegram = xknx.telegrams.get_nowait()
        assert _telegram == Telegram(
            destination_address=GroupAddress("1/2/2"),
            payload=GroupValueWrite(DPT2ByteFloat().to_knx(20.50)),
        )
        xknx.devices.process(_telegram)
        assert climate.target_temperature.value == 20.50

        # Second change
        await climate.set_target_temperature(19.00)
        assert xknx.telegrams.qsize() == 2
        _telegram = xknx.telegrams.get_nowait()
        assert _telegram == Telegram(
            destination_address=GroupAddress("1/2/3"),
            payload=GroupValueWrite(DPTArray(0xE2)),
        )  # -30
        xknx.devices.process(_telegram)
        _telegram = xknx.telegrams.get_nowait()
        assert _telegram == Telegram(
            destination_address=GroupAddress("1/2/2"),
            payload=GroupValueWrite(DPT2ByteFloat().to_knx(19.00)),
        )
        xknx.devices.process(_telegram)
        assert climate.target_temperature.value == 19.00

        # Test min target temperature
        # Base (22) - setpoint_shift_min (6)
        assert climate.target_temperature_min == 16.00

        # third change - limit exceeded, setting to min
        await climate.set_target_temperature(15.50)
        assert xknx.telegrams.qsize() == 2
        xknx.devices.process(xknx.telegrams.get_nowait())
        xknx.devices.process(xknx.telegrams.get_nowait())
        assert climate.target_temperature_min == 16.00
        assert climate.setpoint_shift == -6

    async def test_target_temperature_modified_step(self) -> None:
        """Test increase target temperature with modified step size."""

        xknx = XKNX()
        climate = Climate(
            xknx,
            "TestClimate",
            group_address_target_temperature="1/2/2",
            group_address_setpoint_shift="1/2/3",
            setpoint_shift_mode=SetpointShiftMode.DPT6010,
            temperature_step=0.5,
            setpoint_shift_max=10,
            setpoint_shift_min=-10,
        )
        xknx.devices.async_add(climate)

        await climate.set_setpoint_shift(3)
        assert xknx.telegrams.qsize() == 1
        _telegram = xknx.telegrams.get_nowait()
        xknx.devices.process(_telegram)
        # temperature_step is 0.5 -> payload = setpoint_shift * 2
        assert _telegram == Telegram(
            destination_address=GroupAddress("1/2/3"),
            payload=GroupValueWrite(DPTArray(6)),
        )

        climate.target_temperature.set(23.00)
        assert xknx.telegrams.qsize() == 1
        _telegram = xknx.telegrams.get_nowait()
        xknx.devices.process(_telegram)
        assert _telegram == Telegram(
            destination_address=GroupAddress("1/2/2"),
            payload=GroupValueWrite(DPT2ByteFloat().to_knx(23.00)),
        )
        assert climate.base_temperature == 20.00
        await climate.set_target_temperature(24.00)
        assert xknx.telegrams.qsize() == 2
        _telegram = xknx.telegrams.get_nowait()
        xknx.devices.process(_telegram)
        assert _telegram == Telegram(
            destination_address=GroupAddress("1/2/3"),
            payload=GroupValueWrite(DPTArray(8)),
        )
        _telegram = xknx.telegrams.get_nowait()
        xknx.devices.process(_telegram)
        assert _telegram == Telegram(
            destination_address=GroupAddress("1/2/2"),
            payload=GroupValueWrite(DPT2ByteFloat().to_knx(24.00)),
        )
        assert climate.target_temperature.value == 24.00

        # Test max/min target temperature
        assert climate.target_temperature_max == 30.00
        assert climate.target_temperature_min == 10.00

    #
    # TEST BASE TEMPERATURE
    #

    async def test_base_temperature(self) -> None:
        """Test base temperature."""

        xknx = XKNX()
        climate = Climate(
            xknx,
            "TestClimate",
            group_address_target_temperature_state="1/2/1",
            group_address_target_temperature="1/2/2",
            group_address_setpoint_shift="1/2/3",
            setpoint_shift_mode=SetpointShiftMode.DPT6010,
        )
        xknx.devices.async_add(climate)

        await climate.set_target_temperature(21.00)
        assert xknx.telegrams.qsize() == 1
        _telegram = xknx.telegrams.get_nowait()
        xknx.devices.process(_telegram)
        assert _telegram == Telegram(
            destination_address=GroupAddress("1/2/2"),
            payload=GroupValueWrite(DPT2ByteFloat().to_knx(21.00)),
        )
        assert not climate.initialized_for_setpoint_shift_calculations
        assert climate.base_temperature is None

        # setpoint_shift initialized after target_temperature (no temperature change)
        await climate.set_setpoint_shift(1)
        assert xknx.telegrams.qsize() == 1
        _telegram = xknx.telegrams.get_nowait()
        xknx.devices.process(_telegram)
        # DEFAULT_TEMPERATURE_STEP is 0.1 -> payload = setpoint_shift * 10
        assert _telegram == Telegram(
            destination_address=GroupAddress("1/2/3"),
            payload=GroupValueWrite(DPTArray(10)),
        )
        assert climate.initialized_for_setpoint_shift_calculations
        assert climate.base_temperature == 20.00

        # setpoint_shift changed after initialisation
        await climate.set_setpoint_shift(2)
        # setpoint_shift and target_temperature are sent to the bus
        assert xknx.telegrams.qsize() == 2
        _telegram = xknx.telegrams.get_nowait()
        xknx.devices.process(_telegram)
        # DEFAULT_TEMPERATURE_STEP is 0.1 -> payload = setpoint_shift * 10
        assert _telegram == Telegram(
            destination_address=GroupAddress("1/2/3"),
            payload=GroupValueWrite(DPTArray(20)),
        )
        _telegram = xknx.telegrams.get_nowait()
        xknx.devices.process(_telegram)
        assert climate.initialized_for_setpoint_shift_calculations
        assert climate.base_temperature == 20.00
        assert climate.target_temperature.value == 22

    async def test_target_temperature_step_mode_9002(self) -> None:
        """Test increase target temperature with modified step size."""

        xknx = XKNX()
        climate = Climate(
            xknx,
            "TestClimate",
            group_address_target_temperature_state="1/2/2",
            group_address_setpoint_shift="1/2/3",
            setpoint_shift_mode=SetpointShiftMode.DPT9002,
            setpoint_shift_max=10,
            setpoint_shift_min=-10,
        )
        xknx.devices.async_add(climate)

        # base temperature is 20 °C
        climate.target_temperature.process(
            Telegram(
                destination_address=GroupAddress("1/2/2"),
                payload=GroupValueWrite(DPT2ByteFloat().to_knx(20.00)),
            )
        )
        await climate.set_setpoint_shift(0)
        assert xknx.telegrams.qsize() == 1
        _telegram = xknx.telegrams.get_nowait()
        xknx.devices.process(_telegram)
        assert climate.initialized_for_setpoint_shift_calculations
        assert climate.base_temperature == 20.00
        assert _telegram == Telegram(
            destination_address=GroupAddress("1/2/3"),
            payload=GroupValueWrite(DPTArray((0x00, 0x00))),
        )  # 0
        # - 0.6 °C = 19.4
        await climate.set_target_temperature(19.40)
        assert xknx.telegrams.qsize() == 1
        _telegram = xknx.telegrams.get_nowait()
        xknx.devices.process(_telegram)
        assert _telegram == Telegram(
            destination_address=GroupAddress("1/2/3"),
            payload=GroupValueWrite(DPTArray((0x87, 0xC4))),
        )  # -0.6
        # simulate incoming new target temperature for next calculation
        climate.target_temperature.process(
            Telegram(
                destination_address=GroupAddress("1/2/2"),
                payload=GroupValueWrite(DPT2ByteFloat().to_knx(19.40)),
            )
        )
        # + 3.5 °C = 23.5
        await climate.set_target_temperature(23.50)
        assert xknx.telegrams.qsize() == 1
        _telegram = xknx.telegrams.get_nowait()
        xknx.devices.process(_telegram)
        assert _telegram == Telegram(
            destination_address=GroupAddress("1/2/3"),
            payload=GroupValueWrite(DPTArray((0x01, 0x5E))),
        )  # +3.5

    #
    # TEST TEMPERATURE STEP
    #
    async def test_temperature_step(self) -> None:
        """Test base temperature step."""

        xknx = XKNX()
        climate = Climate(
            xknx,
            "TestClimate",
            group_address_target_temperature_state="1/2/1",
            group_address_target_temperature="1/2/2",
        )

        await climate.set_target_temperature(21.00)
        # default temperature_step for non setpoint_shift
        assert climate.temperature_step == 0.1

        climate = Climate(
            xknx,
            "TestClimate",
            group_address_target_temperature_state="1/2/1",
            group_address_target_temperature="1/2/2",
            group_address_setpoint_shift="1/2/3",
        )
        # default temperature_step for setpoint_shift
        assert climate.temperature_step == 0.1

        climate = Climate(
            xknx,
            "TestClimate",
            group_address_target_temperature_state="1/2/1",
            group_address_target_temperature="1/2/2",
            group_address_setpoint_shift="1/2/3",
            temperature_step=0.3,
        )
        assert climate.temperature_step == 0.3

    #
    # TEST SYNC
    #
    async def test_sync(self) -> None:
        """Test sync function / sending group reads to KNX bus."""
        xknx = XKNX()
        climate = Climate(xknx, "TestClimate", group_address_temperature="1/2/3")
        await climate.sync()
        assert xknx.telegrams.qsize() == 1
        telegram1 = xknx.telegrams.get_nowait()
        assert telegram1 == Telegram(GroupAddress("1/2/3"), payload=GroupValueRead())

    async def test_sync_operation_mode(self) -> None:
        """Test sync function / sending group reads to KNX bus for operation mode."""
        xknx = XKNX()
        climate_mode = ClimateMode(
            xknx,
            "TestClimate",
            group_address_operation_mode="1/2/3",
            group_address_operation_mode_state="1/2/4",
        )
        await climate_mode.sync()
        assert xknx.telegrams.qsize() == 1
        telegram1 = xknx.telegrams.get_nowait()
        assert telegram1 == Telegram(GroupAddress("1/2/4"), payload=GroupValueRead())

    async def test_sync_controller_status(self) -> None:
        """Test sync function / sending group reads to KNX bus for controller status."""
        xknx = XKNX()
        climate_mode = ClimateMode(
            xknx,
            "TestClimate",
            group_address_operation_mode="1/2/23",
            group_address_controller_status_state="1/2/24",
        )
        await climate_mode.sync()
        assert xknx.telegrams.qsize() == 1
        telegram1 = xknx.telegrams.get_nowait()
        assert telegram1 == Telegram(GroupAddress("1/2/24"), payload=GroupValueRead())

    async def test_sync_controller_mode(self) -> None:
        """Test sync function / sending group reads to KNX bus for controller mode."""
        xknx = XKNX()
        climate_mode = ClimateMode(
            xknx,
            "TestClimate",
            group_address_controller_mode="1/2/13",
            group_address_controller_mode_state="1/2/14",
        )
        await climate_mode.sync()
        assert xknx.telegrams.qsize() == 1
        telegram1 = xknx.telegrams.get_nowait()
        assert telegram1 == Telegram(GroupAddress("1/2/14"), payload=GroupValueRead())

    async def test_sync_operation_mode_state(self) -> None:
        """Test sync function / sending group reads to KNX bus for multiple mode addresses."""
        xknx = XKNX()
        climate_mode = ClimateMode(
            xknx,
            "TestClimate",
            group_address_operation_mode="1/2/3",
            group_address_operation_mode_state="1/2/5",
            group_address_controller_status="1/2/4",
            group_address_controller_status_state="1/2/6",
            group_address_controller_mode="1/2/13",
            group_address_controller_mode_state="1/2/14",
        )
        await climate_mode.sync()
        assert xknx.telegrams.qsize() == 3

        telegrams = [xknx.telegrams.get_nowait() for _ in range(3)]
        assert telegrams == [
            Telegram(GroupAddress("1/2/5"), payload=GroupValueRead()),
            Telegram(GroupAddress("1/2/14"), payload=GroupValueRead()),
            Telegram(GroupAddress("1/2/6"), payload=GroupValueRead()),
        ]

    async def test_sync_heat_cool(self) -> None:
        """Test sync function / sending group reads to KNX bus for heat/cool."""
        xknx = XKNX()
        climate_mode = ClimateMode(
            xknx,
            "TestClimate",
            group_address_heat_cool="1/2/14",
            group_address_heat_cool_state="1/2/15",
        )
        await climate_mode.sync()
        assert xknx.telegrams.qsize() == 1
        telegram1 = xknx.telegrams.get_nowait()
        assert telegram1 == Telegram(GroupAddress("1/2/15"), payload=GroupValueRead())

    async def test_sync_mode_from_climate(self) -> None:
        """Test sync function / propagating to mode."""
        xknx = XKNX()
        climate_mode = ClimateMode(
            xknx, "TestClimateMode", group_address_operation_mode_state="1/2/4"
        )
        climate = Climate(xknx, "TestClimate", mode=climate_mode)

        await climate.sync()
        assert xknx.telegrams.qsize() == 1
        telegram1 = xknx.telegrams.get_nowait()
        assert telegram1 == Telegram(GroupAddress("1/2/4"), payload=GroupValueRead())

    async def test_sync_humidity(self) -> None:
        """Test sync function / sending group reads to KNX bus for humidity."""
        xknx = XKNX()
        climate = Climate(xknx, "TestClimate", group_address_humidity_state="1/2/16")
        await climate.sync()
        assert xknx.telegrams.qsize() == 1
        telegram1 = xknx.telegrams.get_nowait()
        assert telegram1 == Telegram(GroupAddress("1/2/16"), payload=GroupValueRead())

    #
    # TEST PROCESS
    #
    async def test_process_temperature(self) -> None:
        """Test process / reading telegrams from telegram queue. Test if temperature is processed correctly."""
        xknx = XKNX()
        climate = Climate(xknx, "TestClimate", group_address_temperature="1/2/3")

        telegram = Telegram(
            destination_address=GroupAddress("1/2/3"),
            payload=GroupValueWrite(DPTTemperature().to_knx(21.34)),
        )
        climate.process(telegram)
        assert climate.temperature.value == 21.34

    async def test_process_operation_mode(self) -> None:
        """Test process / reading telegrams from telegram queue. Test if operation mode is processed correctly."""
        xknx = XKNX()
        climate_mode = ClimateMode(
            xknx,
            "TestClimate",
            group_address_operation_mode="1/2/5",
            group_address_controller_status="1/2/3",
        )
        for operation_mode in DPT_20102_MODES:
            telegram = Telegram(
                destination_address=GroupAddress("1/2/5"),
                payload=GroupValueWrite(DPTHVACMode.to_knx(operation_mode)),
            )
            climate_mode.process(telegram)
            assert climate_mode.operation_mode == operation_mode
        for operation_mode in DPT_20102_MODES:
            if operation_mode == HVACOperationMode.AUTO:
                continue
            telegram = Telegram(
                destination_address=GroupAddress("1/2/3"),
                payload=GroupValueWrite(
                    DPTHVACStatus.to_knx(
                        HVACStatus(
                            mode=operation_mode,
                            dew_point=False,
                            heat_cool=HVACControllerMode.HEAT,
                            inactive=False,
                            frost_alarm=False,
                        )
                    )
                ),
            )
            climate_mode.process(telegram)
            assert climate_mode.operation_mode == operation_mode

    async def test_process_controller_mode(self) -> None:
        """Test process / reading telegrams from telegram queue. Test if DPT20.105 controller mode is set correctly."""
        xknx = XKNX()
        climate_mode = ClimateMode(
            xknx, "TestClimate", group_address_controller_mode="1/2/5"
        )
        for controller_mode in DPTHVACContrMode.get_valid_values():
            telegram = Telegram(
                destination_address=GroupAddress("1/2/5"),
                payload=GroupValueWrite(DPTHVACContrMode.to_knx(controller_mode)),
            )
            climate_mode.process(telegram)
            assert climate_mode.controller_mode == controller_mode

    async def test_process_controller_status_wrong_payload(self) -> None:
        """Test process wrong telegram for controller status (wrong payload type)."""
        xknx = XKNX()
        updated_cb = Mock()
        climate_mode = ClimateMode(
            xknx,
            "TestClimate",
            group_address_operation_mode="1/2/5",
            group_address_controller_status="1/2/3",
            device_updated_cb=updated_cb,
        )
        telegram = Telegram(
            destination_address=GroupAddress("1/2/3"),
            payload=GroupValueWrite(DPTBinary(1)),
        )
        with patch("logging.Logger.warning") as log_mock:
            climate_mode.process(telegram)
            log_mock.assert_called_once()
            updated_cb.assert_not_called()

    async def test_process_controller_status_payload_invalid_length(self) -> None:
        """Test process wrong telegram for controller status (wrong payload length)."""
        xknx = XKNX()
        updated_cb = Mock()
        climate_mode = ClimateMode(
            xknx,
            "TestClimate",
            group_address_operation_mode="1/2/5",
            group_address_controller_status="1/2/3",
            device_updated_cb=updated_cb,
        )
        telegram = Telegram(
            destination_address=GroupAddress("1/2/3"),
            payload=GroupValueWrite(DPTArray((23, 24))),
        )
        with patch("logging.Logger.warning") as log_mock:
            climate_mode.process(telegram)
            log_mock.assert_called_once()
            updated_cb.assert_not_called()

    async def test_process_operation_mode_wrong_payload(self) -> None:
        """Test process wrong telegram for operation mode (wrong payload type)."""
        xknx = XKNX()
        updated_cb = Mock()
        climate_mode = ClimateMode(
            xknx,
            "TestClimate",
            group_address_operation_mode="1/2/5",
            group_address_controller_status="1/2/3",
            device_updated_cb=updated_cb,
        )
        telegram = Telegram(
            destination_address=GroupAddress("1/2/5"),
            payload=GroupValueWrite(DPTBinary(1)),
        )
        with patch("logging.Logger.warning") as log_mock:
            climate_mode.process(telegram)
            log_mock.assert_called_once()
            updated_cb.assert_not_called()

    async def test_process_operation_mode_payload_invalid_length(self) -> None:
        """Test process wrong telegram for operation mode (wrong payload length)."""
        xknx = XKNX()
        updated_cb = Mock()
        climate_mode = ClimateMode(
            xknx,
            "TestClimate",
            group_address_operation_mode="1/2/5",
            group_address_controller_status="1/2/3",
            device_updated_cb=updated_cb,
        )
        telegram = Telegram(
            destination_address=GroupAddress("1/2/5"),
            payload=GroupValueWrite(DPTArray((23, 24))),
        )
        with patch("logging.Logger.warning") as log_mock:
            climate_mode.process(telegram)
            log_mock.assert_called_once()
            updated_cb.assert_not_called()

    async def test_process_callback_temp(self) -> None:
        """Test process / reading telegrams from telegram queue. Test if callback is executed when receiving temperature."""

        xknx = XKNX()
        climate = Climate(xknx, "TestClimate", group_address_temperature="1/2/3")
        after_update_callback = Mock()
        climate.register_device_updated_cb(after_update_callback)

        telegram = Telegram(
            destination_address=GroupAddress("1/2/3"),
            payload=GroupValueWrite(DPTTemperature().to_knx(21.34)),
        )
        climate.process(telegram)
        after_update_callback.assert_called_with(climate)

    async def test_process_heat_cool(self) -> None:
        """Test process / reading telegrams from telegram queue. Test if heat/cool is set correctly."""
        xknx = XKNX()
        climate_mode = ClimateMode(
            xknx,
            "TestClimate",
            group_address_operation_mode="i-op-mode",
            group_address_heat_cool="1/2/14",
            group_address_heat_cool_state="1/2/15",
        )

        telegram = Telegram(
            destination_address=GroupAddress("1/2/14"),
            payload=GroupValueWrite(DPTBinary(False)),
        )
        climate_mode.process(telegram)
        assert climate_mode.controller_mode == HVACControllerMode.COOL

        telegram = Telegram(
            destination_address=GroupAddress("1/2/14"),
            payload=GroupValueWrite(DPTBinary(True)),
        )
        climate_mode.process(telegram)
        assert climate_mode.controller_mode == HVACControllerMode.HEAT

    async def test_process_humidity(self) -> None:
        """Test process / reading telegrams from telegram queue. Test if humidity is processed correctly."""
        xknx = XKNX()
        climate = Climate(xknx, "TestClimate", group_address_humidity_state="1/2/16")
        after_update_callback = Mock()
        climate.register_device_updated_cb(after_update_callback)

        telegram = Telegram(
            destination_address=GroupAddress("1/2/16"),
            payload=GroupValueWrite(DPTHumidity.to_knx(45.6)),
        )
        climate.process(telegram)

        assert climate.humidity.value == 45.6
        after_update_callback.assert_called_with(climate)

    #
    # SUPPORTED OPERATION MODES
    #
    def test_supported_operation_modes(self) -> None:
        """Test get_supported_operation_modes with combined group address."""
        xknx = XKNX()
        climate_mode = ClimateMode(
            xknx, "TestClimate", group_address_operation_mode="1/2/5"
        )
        assert set(climate_mode.operation_modes) == {
            HVACOperationMode.AUTO,
            HVACOperationMode.COMFORT,
            HVACOperationMode.STANDBY,
            HVACOperationMode.ECONOMY,
            HVACOperationMode.BUILDING_PROTECTION,
        }

    def test_supported_modes_controller_status(self) -> None:
        """Test supported modes with HVAC status group address."""
        xknx = XKNX()
        climate_mode = ClimateMode(
            xknx, "TestClimate", group_address_controller_status="1/2/5"
        )
        assert set(climate_mode.operation_modes) == {
            HVACOperationMode.COMFORT,
            HVACOperationMode.STANDBY,
            HVACOperationMode.ECONOMY,
            HVACOperationMode.BUILDING_PROTECTION,
        }
        assert set(climate_mode.controller_modes) == {
            HVACControllerMode.HEAT,
            HVACControllerMode.COOL,
        }

    def test_supported_operation_modes_no_mode(self) -> None:
        """Test get_supported_operation_modes no operation_modes supported."""
        xknx = XKNX()
        climate_mode = ClimateMode(xknx, "TestClimate")
        assert not climate_mode.operation_modes

    def test_supported_operation_modes_with_separate_addresses(self) -> None:
        """Test get_supported_operation_modes with separated group addresses."""
        xknx = XKNX()
        climate_mode = ClimateMode(
            xknx,
            "TestClimate",
            group_address_operation_mode_protection="1/2/5",
            group_address_operation_mode_economy="1/2/6",
            group_address_operation_mode_comfort="1/2/7",
        )

        assert set(climate_mode.operation_modes) == {
            HVACOperationMode.COMFORT,
            HVACOperationMode.ECONOMY,
            HVACOperationMode.BUILDING_PROTECTION,
            HVACOperationMode.STANDBY,
        }

    def test_supported_operation_modes_only_economy(self) -> None:
        """Test get_supported_operation_modes with only economy mode supported."""
        xknx = XKNX()
        climate_mode = ClimateMode(
            xknx, "TestClimate", group_address_operation_mode_economy="1/2/7"
        )
        # If one binary climate object is set, this mode and Standby are supported.
        # All binary modes off -> Standby according to MDT heating actuator
        assert set(climate_mode.operation_modes) == {
            HVACOperationMode.ECONOMY,
            HVACOperationMode.STANDBY,
        }

    def test_supported_operation_modes_heat_cool(self) -> None:
        """Test supported controller_modes with heat_cool address."""
        xknx = XKNX()
        climate_mode = ClimateMode(
            xknx,
            "TestClimate",
            group_address_heat_cool="1/2/14",
            group_address_heat_cool_state="1/2/15",
        )
        assert climate_mode.supports_controller_mode
        assert set(climate_mode.controller_modes) == {
            HVACControllerMode.HEAT,
            HVACControllerMode.COOL,
        }

    def test_supported_operation_modes_heat_cool_read_only(self) -> None:
        """Test supported controller_modes with heat_cool_state address."""
        xknx = XKNX()
        climate_mode = ClimateMode(
            xknx,
            "TestClimate",
            group_address_heat_cool_state="1/2/15",
        )
        assert climate_mode.supports_controller_mode
        assert climate_mode.controller_modes == []  # only writable modes
        assert set(climate_mode.gather_controller_modes(only_writable=False)) == {
            HVACControllerMode.HEAT,
            HVACControllerMode.COOL,
        }

    def test_custom_supported_operation_modes(self) -> None:
        """Test get_supported_operation_modes with custom mode."""
        modes = [HVACOperationMode.STANDBY, HVACOperationMode.ECONOMY]
        xknx = XKNX()
        climate_mode = ClimateMode(
            xknx,
            "TestClimate",
            group_address_operation_mode="1/2/7",
            operation_modes=modes,
        )
        assert climate_mode.operation_modes == modes

    def test_custom_supported_operation_modes_as_str(self) -> None:
        """Test get_supported_operation_modes with custom mode as str list."""
        str_modes = ["Standby", "Building Protection"]
        modes = [HVACOperationMode.STANDBY, HVACOperationMode.BUILDING_PROTECTION]
        xknx = XKNX()
        climate_mode = ClimateMode(
            xknx,
            "TestClimate",
            group_address_operation_mode="1/2/7",
            operation_modes=str_modes,
        )
        assert climate_mode.operation_modes == modes

    def test_custom_supported_operation_modes_only_valid(self) -> None:
        """Test get_supported_operation_modes with custom mode as str list."""
        str_modes = [
            "Standby",
            "Building Protection",
            "Comfort",  # Comfort can't be set - no address set
        ]
        modes = [HVACOperationMode.STANDBY, HVACOperationMode.BUILDING_PROTECTION]
        xknx = XKNX()
        climate_mode = ClimateMode(
            xknx,
            "TestClimate",
            group_address_operation_mode_standby="1/2/7",
            group_address_operation_mode_protection="1/2/8",
            operation_modes=str_modes,
        )
        assert climate_mode.operation_modes == modes

    def test_custom_supported_controller_modes_as_str(self) -> None:
        """Test get_supported_operation_modes with custom mode as str list."""
        str_modes = ["Heat", "Cool", HVACControllerMode.NODEM]
        modes = [
            HVACControllerMode.HEAT,
            HVACControllerMode.COOL,
            HVACControllerMode.NODEM,
        ]
        xknx = XKNX()
        climate_mode = ClimateMode(
            xknx,
            "TestClimate",
            group_address_controller_mode="1/2/7",
            controller_modes=str_modes,
        )
        assert climate_mode.controller_modes == modes

    def test_custom_supported_controller_modes_when_controller_mode_unsupported(
        self,
    ) -> None:
        """Test get_supported_operation_modes with custom mode as str list."""
        str_modes = ["Heat", "Cool"]
        modes = []
        xknx = XKNX()
        climate_mode = ClimateMode(
            xknx,
            "TestClimate",
            controller_modes=str_modes,
        )
        assert climate_mode.controller_modes == modes

    async def test_process_power_status(self) -> None:
        """Test process / reading telegrams from telegram queue. Test if DPT20.105 controller mode is set correctly."""
        xknx = XKNX()
        climate = Climate(xknx, "TestClimate", group_address_on_off="1/2/2")
        telegram = Telegram(
            destination_address=GroupAddress("1/2/2"),
            payload=GroupValueWrite(DPTBinary(1)),
        )
        climate.process(telegram)
        assert climate.is_on is True

        climate_inv = Climate(
            xknx, "TestClimate", group_address_on_off="1/2/2", on_off_invert=True
        )
        telegram = Telegram(
            destination_address=GroupAddress("1/2/2"),
            payload=GroupValueWrite(DPTBinary(1)),
        )
        climate_inv.process(telegram)
        assert climate_inv.is_on is False

    async def test_power_on_off(self) -> None:
        """Test turn_on and turn_off functions."""
        xknx = XKNX()
        climate = Climate(xknx, "TestClimate", group_address_on_off="1/2/2")
        xknx.devices.async_add(climate)

        await climate.turn_on()
        _telegram = xknx.telegrams.get_nowait()
        xknx.devices.process(_telegram)
        assert climate.is_on is True
        assert _telegram == Telegram(
            destination_address=GroupAddress("1/2/2"),
            payload=GroupValueWrite(DPTBinary(True)),
        )
        await climate.turn_off()
        _telegram = xknx.telegrams.get_nowait()
        xknx.devices.process(_telegram)
        assert climate.is_on is False
        assert _telegram == Telegram(
            destination_address=GroupAddress("1/2/2"),
            payload=GroupValueWrite(DPTBinary(False)),
        )

        climate_inv = Climate(
            xknx, "TestClimate", group_address_on_off="1/2/2", on_off_invert=True
        )
        xknx.devices.async_add(climate_inv)

        await climate_inv.turn_on()
        _telegram = xknx.telegrams.get_nowait()
        xknx.devices.process(_telegram)
        assert climate_inv.is_on is True
        assert _telegram == Telegram(
            destination_address=GroupAddress("1/2/2"),
            payload=GroupValueWrite(DPTBinary(False)),
        )
        await climate_inv.turn_off()
        _telegram = xknx.telegrams.get_nowait()
        xknx.devices.process(_telegram)
        assert climate_inv.is_on is False
        assert _telegram == Telegram(
            destination_address=GroupAddress("1/2/2"),
            payload=GroupValueWrite(DPTBinary(True)),
        )

    async def test_is_active(self) -> None:
        """Test is_active property."""
        xknx = XKNX()
        climate_active = Climate(
            xknx, "TestClimate1", group_address_active_state="1/1/1"
        )
        xknx.devices.async_add(climate_active)
        climate_command = Climate(
            xknx, "TestClimate2", group_address_command_value_state="2/2/2"
        )
        xknx.devices.async_add(climate_command)
        climate_active_command = Climate(
            xknx,
            "TestClimate3",
            group_address_active_state="1/1/1",
            group_address_command_value_state="2/2/2",
        )
        xknx.devices.async_add(climate_active_command)

        assert climate_active.is_active is None
        assert climate_command.is_active is None
        assert climate_active_command.is_active is None
        # set active to False
        xknx.devices.process(
            Telegram(
                destination_address=GroupAddress("1/1/1"),
                payload=GroupValueWrite(DPTBinary(False)),
            )
        )
        assert climate_active.is_active is False
        assert climate_command.is_active is None
        assert climate_active_command.is_active is False
        # set command to 50%
        xknx.devices.process(
            Telegram(
                destination_address=GroupAddress("2/2/2"),
                payload=GroupValueWrite(DPTArray((128,))),
            )
        )
        assert climate_active.is_active is False
        assert climate_command.is_active is True
        assert climate_active_command.is_active is False
        # set active to True
        xknx.devices.process(
            Telegram(
                destination_address=GroupAddress("1/1/1"),
                payload=GroupValueWrite(DPTBinary(True)),
            )
        )
        assert climate_active.is_active is True
        assert climate_command.is_active is True
        assert climate_active_command.is_active is True
        # set command to 0%
        xknx.devices.process(
            Telegram(
                destination_address=GroupAddress("2/2/2"),
                payload=GroupValueWrite(DPTArray((0,))),
            )
        )
        assert climate_active.is_active is True
        assert climate_command.is_active is False
        assert climate_active_command.is_active is True
        # only command initialized
        climate_active_command.active.value = None
        assert climate_active_command.is_active is False

    async def test_fan_speed(self) -> None:
        """Test fan speed functionality."""
        xknx = XKNX()
        climate_step = Climate(
            xknx,
            name="TestClimate",
            group_address_fan_speed="1/2/3",
            group_address_fan_speed_state="1/2/4",
            fan_speed_mode=FanSpeedMode.STEP,
        )
        xknx.devices.async_add(climate_step)
        climate_percent = Climate(
            xknx,
            name="TestClimate",
            group_address_fan_speed="1/2/5",
            group_address_fan_speed_state="1/2/6",
        )
        assert climate_percent.fan_speed_mode == FanSpeedMode.PERCENT
        xknx.devices.async_add(climate_percent)

        # Test initial state
        assert climate_step.current_fan_speed is None
        assert climate_percent.current_fan_speed is None

        xknx.devices.process(
            Telegram(
                destination_address=GroupAddress("1/2/3"),
                payload=GroupValueWrite(DPTArray(2)),
            )
        )
        assert climate_step.current_fan_speed == 2

        # 140 is 55% as byte (0...255)
        xknx.devices.process(
            Telegram(
                destination_address=GroupAddress("1/2/5"),
                payload=GroupValueWrite(DPTArray(140)),
            )
        )
        assert climate_percent.current_fan_speed == 55

        await climate_step.set_fan_speed(3)
        assert xknx.telegrams.qsize() == 1
        telegram = xknx.telegrams.get_nowait()
        assert telegram == Telegram(
            destination_address=GroupAddress("1/2/3"),
            payload=GroupValueWrite(DPTArray(3)),
        )

        await climate_percent.set_fan_speed(45)
        assert xknx.telegrams.qsize() == 1
        telegram = xknx.telegrams.get_nowait()
        # 115 is 45% as byte (0...255)
        assert telegram == Telegram(
            destination_address=GroupAddress("1/2/5"),
            payload=GroupValueWrite(DPTArray(115)),
        )

        xknx.devices.process(
            Telegram(
                destination_address=GroupAddress("1/2/4"),
                payload=GroupValueWrite(DPTArray(2)),
            )
        )
        assert climate_step.current_fan_speed == 2

        # 140 is 55% as byte (0...255)
        xknx.devices.process(
            Telegram(
                destination_address=GroupAddress("1/2/6"),
                payload=GroupValueWrite(DPTArray(140)),
            )
        )
        assert climate_percent.current_fan_speed == 55

    async def test_swing(self) -> None:
        """Test fan speed functionality."""
        xknx = XKNX()
        climate_swing = Climate(
            xknx,
            name="TestClimate",
            group_address_swing="1/2/3",
            group_address_swing_state="1/2/4",
        )
        xknx.devices.async_add(climate_swing)

        # Test initial state
        assert climate_swing.current_swing is None

        xknx.devices.process(
            Telegram(
                destination_address=GroupAddress("1/2/3"),
                payload=GroupValueWrite(DPTBinary(True)),
            )
        )
        assert climate_swing.current_swing is True

        await climate_swing.set_swing(False)
        assert xknx.telegrams.qsize() == 1
        telegram = xknx.telegrams.get_nowait()
        assert telegram == Telegram(
            destination_address=GroupAddress("1/2/3"),
            payload=GroupValueWrite(DPTBinary(False)),
        )

    async def test_horizontal_swing(self) -> None:
        """Test fan speed functionality."""
        xknx = XKNX()
        climate_horizontal_swing = Climate(
            xknx,
            name="TestClimate",
            group_address_horizontal_swing="1/2/3",
            group_address_horizontal_swing_state="1/2/4",
        )
        xknx.devices.async_add(climate_horizontal_swing)

        # Test initial state
        assert climate_horizontal_swing.current_horizontal_swing is None

        xknx.devices.process(
            Telegram(
                destination_address=GroupAddress("1/2/3"),
                payload=GroupValueWrite(DPTBinary(True)),
            )
        )
        assert climate_horizontal_swing.current_horizontal_swing is True

        await climate_horizontal_swing.set_horizontal_swing(False)
        assert xknx.telegrams.qsize() == 1
        telegram = xknx.telegrams.get_nowait()
        assert telegram == Telegram(
            destination_address=GroupAddress("1/2/3"),
            payload=GroupValueWrite(DPTBinary(False)),
        )