Skip to content

Commit 052e2ca

Browse files
jclsnmrrstux
authored andcommitted
Add Bosch Thermostat 2 quirk
1 parent bfbfb48 commit 052e2ca

File tree

1 file changed

+161
-0
lines changed

1 file changed

+161
-0
lines changed

zhaquirks/bosch/rbsh_trv0_zb_eu.py

Lines changed: 161 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,161 @@
1+
"""Device handler for Bosch RBSH-TRV0-ZB-EU thermostat."""
2+
3+
from zigpy.profiles import zha
4+
import zigpy.types as t
5+
from zigpy.quirks import CustomDevice
6+
from zigpy.zcl.clusters import general, hvac, homeautomation
7+
8+
from zigpy.zcl.clusters.general import (
9+
Basic,
10+
Identify,
11+
Ota,
12+
PollControl,
13+
Groups,
14+
Time,
15+
PowerConfiguration,
16+
ZCLAttributeDef,
17+
)
18+
from zigpy.zcl.clusters.hvac import Thermostat, UserInterface
19+
from zigpy.zcl.clusters.homeautomation import Diagnostic
20+
21+
from zhaquirks import CustomCluster
22+
from zhaquirks.const import (
23+
DEVICE_TYPE,
24+
ENDPOINTS,
25+
INPUT_CLUSTERS,
26+
MODELS_INFO,
27+
OUTPUT_CLUSTERS,
28+
PROFILE_ID,
29+
)
30+
31+
32+
class BoschOperatingMode(t.enum8):
33+
Schedule = 0x00
34+
Manual = 0x01
35+
Pause = 0x05
36+
37+
38+
class State(t.enum8):
39+
Off = 0x00
40+
On = 0x01
41+
42+
43+
class BoschDisplayOrientation(t.enum8):
44+
Normal = 0x00
45+
Flipped = 0x01
46+
47+
48+
class BoschDisplayedTemperature(t.enum8):
49+
Target = 0x00
50+
Measured = 0x01
51+
52+
53+
class BoschThermostatCluster(CustomCluster, Thermostat):
54+
"""Bosch thermostat cluster."""
55+
56+
class AttributeDefs(Thermostat.AttributeDefs):
57+
operating_mode = ZCLAttributeDef(
58+
id=t.uint16_t(0x4007),
59+
type=BoschOperatingMode,
60+
is_manufacturer_specific=True,
61+
)
62+
63+
pi_heating_demand = ZCLAttributeDef(
64+
id=t.uint16_t(0x4020),
65+
# Values range from 0-100
66+
type=t.enum8,
67+
is_manufacturer_specific=True,
68+
)
69+
70+
window_open = ZCLAttributeDef(
71+
id=t.uint16_t(0x4042),
72+
type=State,
73+
is_manufacturer_specific=True,
74+
)
75+
76+
boost = ZCLAttributeDef(
77+
id=t.uint16_t(0x4043),
78+
type=State,
79+
is_manufacturer_specific=True,
80+
)
81+
82+
83+
class BoschUserInterfaceCluster(CustomCluster, UserInterface):
84+
"""Bosch UserInterface cluster."""
85+
86+
class AttributeDefs(UserInterface.AttributeDefs):
87+
display_orientation = ZCLAttributeDef(
88+
id=t.uint16_t(0x400B),
89+
type=BoschDisplayOrientation,
90+
is_manufacturer_specific=True,
91+
)
92+
93+
display_ontime = ZCLAttributeDef(
94+
id=t.uint16_t(0x403A),
95+
# Usable values range from 2-30
96+
type=t.enum8,
97+
is_manufacturer_specific=True,
98+
)
99+
100+
display_brightness = ZCLAttributeDef(
101+
id=t.uint16_t(0x403B),
102+
# Values range from 0-10
103+
type=t.enum8,
104+
is_manufacturer_specific=True,
105+
)
106+
107+
displayed_temperature = ZCLAttributeDef(
108+
id=t.uint16_t(0x4039),
109+
type=BoschDisplayedTemperature,
110+
is_manufacturer_specific=True,
111+
)
112+
113+
114+
class BoschThermostat(CustomDevice):
115+
"""Bosch thermostat custom device."""
116+
117+
signature = {
118+
MODELS_INFO: [("BOSCH", "RBSH-TRV0-ZB-EU")],
119+
ENDPOINTS: {
120+
# <SimpleDescriptor endpoint=1 profile=260 device_type=769
121+
# device_version=1
122+
# input_clusters=[0, 1, 3, 4, 32, 513, 516, 2821]
123+
# output_clusters=[10, 25]>
124+
1: {
125+
PROFILE_ID: zha.PROFILE_ID,
126+
DEVICE_TYPE: zha.DeviceType.THERMOSTAT,
127+
INPUT_CLUSTERS: [
128+
general.Basic.cluster_id,
129+
general.PowerConfiguration.cluster_id,
130+
general.Identify.cluster_id,
131+
general.Groups.cluster_id,
132+
general.PollControl.cluster_id,
133+
hvac.Thermostat.cluster_id,
134+
hvac.UserInterface.cluster_id,
135+
homeautomation.Diagnostic.cluster_id,
136+
],
137+
OUTPUT_CLUSTERS: [general.Ota.cluster_id,
138+
general.Time.cluster_id],
139+
},
140+
},
141+
}
142+
143+
replacement = {
144+
ENDPOINTS: {
145+
1: {
146+
INPUT_CLUSTERS: [
147+
Basic,
148+
BoschThermostatCluster,
149+
BoschUserInterfaceCluster,
150+
Diagnostic,
151+
Groups,
152+
Identify,
153+
Ota,
154+
PollControl,
155+
PowerConfiguration,
156+
Time,
157+
],
158+
OUTPUT_CLUSTERS: [Ota, Time],
159+
},
160+
},
161+
}

0 commit comments

Comments
 (0)