Skip to content

Commit f36d576

Browse files
mrrstuxjclsn
authored andcommitted
Add heating-by-id attribute write test.
1 parent 540644f commit f36d576

File tree

1 file changed

+19
-5
lines changed

1 file changed

+19
-5
lines changed

tests/test_bosch.py

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,14 @@
22

33
from unittest import mock
44

5-
from zigpy.zcl import foundation
6-
from zigpy.zcl.clusters.hvac import ControlSequenceOfOperation, Thermostat
7-
from zigpy.zcl.foundation import WriteAttributesStatusRecord
8-
95
import zhaquirks
106
from zhaquirks.bosch.rbsh_trv0_zb_eu import (
117
BoschOperatingMode,
128
BoschThermostatCluster as BoschTrvThermostatCluster,
139
)
10+
from zigpy.zcl import foundation
11+
from zigpy.zcl.clusters.hvac import ControlSequenceOfOperation, Thermostat
12+
from zigpy.zcl.foundation import WriteAttributesStatusRecord
1413

1514
zhaquirks.setup()
1615

@@ -58,7 +57,7 @@ def mock_read(attributes, manufacturer=None):
5857

5958
# check that system_mode ends-up writing operating_mode:
6059
with patch_bosch_trv_write, patch_bosch_trv_read:
61-
# - Heating operation
60+
# - Heating operation - by name
6261
success, fail = await bosch_thermostat_cluster.write_attributes(
6362
{"ctrl_sequence_of_oper": ControlSequenceOfOperation.Heating_Only}
6463
)
@@ -71,6 +70,21 @@ def mock_read(attributes, manufacturer=None):
7170
== ControlSequenceOfOperation.Heating_Only
7271
)
7372

73+
# - Heating operation - by id
74+
success, fail = await bosch_thermostat_cluster.write_attributes(
75+
{
76+
Thermostat.AttributeDefs.ctrl_sequence_of_oper.id: ControlSequenceOfOperation.Heating_Only
77+
}
78+
)
79+
assert success
80+
assert not fail
81+
assert (
82+
bosch_thermostat_cluster._attr_cache[
83+
Thermostat.AttributeDefs.ctrl_sequence_of_oper.id
84+
]
85+
== ControlSequenceOfOperation.Heating_Only
86+
)
87+
7488
# -- Off (by-name)
7589
success, fail = await bosch_thermostat_cluster.write_attributes(
7690
{Thermostat.AttributeDefs.system_mode.name: Thermostat.SystemMode.Off}

0 commit comments

Comments
 (0)