5
5
from zigpy .quirks .v2 .homeassistant import PERCENTAGE , EntityType , UnitOfTemperature
6
6
from zigpy .quirks .v2 .homeassistant .number import NumberDeviceClass
7
7
from zigpy .quirks .v2 .homeassistant .sensor import SensorStateClass
8
+ from zigpy .quirks .v2 .homeassistant .binary_sensor import BinarySensorDeviceClass
8
9
import zigpy .types as t
9
10
from zigpy .zcl .clusters .hvac import TemperatureDisplayMode , Thermostat , UserInterface
10
11
from zigpy .zcl .foundation import ZCLAttributeDef
@@ -123,61 +124,64 @@ class AttributeDefs(Thermostat.AttributeDefs):
123
124
id = OPERATING_MODE_ATTR_ID ,
124
125
type = BoschOperatingMode ,
125
126
is_manufacturer_specific = True ,
127
+ access = "rwp" ,
126
128
)
127
129
128
130
valve_duty_cycle = ZCLAttributeDef (
129
131
id = VALVE_DUTY_CYCLE_ATTR_ID ,
130
132
# Values range from 0-100
131
133
type = t .uint8_t ,
132
134
is_manufacturer_specific = True ,
135
+ access = "rwp" ,
136
+ )
137
+
138
+ valve_state = ZCLAttributeDef (
139
+ id = VALVE_STATE_ATTR_ID ,
140
+ type = State ,
141
+ is_manufacturer_specific = True ,
142
+ access = "rwp" ,
133
143
)
134
144
135
145
window_open = ZCLAttributeDef (
136
146
id = WINDOW_OPEN_ATTR_ID ,
137
147
type = State ,
138
148
is_manufacturer_specific = True ,
149
+ access = "rwp" ,
139
150
)
140
151
141
152
boost_heating = ZCLAttributeDef (
142
153
id = BOOST_HEATING_ATTR_ID ,
143
154
type = State ,
144
155
is_manufacturer_specific = True ,
145
- )
146
-
147
- temperature_display_mode = ZCLAttributeDef (
148
- id = 0x0000 ,
149
- type = TemperatureDisplayMode ,
150
- access = "rw" ,
156
+ access = "rwp" ,
151
157
)
152
158
153
159
outdoor_temperature = ZCLAttributeDef (
154
160
id = OUTDOOR_TEMP_ATTR_ID ,
155
161
type = t .int16s ,
156
162
is_manufacturer_specific = True ,
163
+ access = "rwp" ,
157
164
)
158
165
159
166
external_sensor_temperature = ZCLAttributeDef (
160
167
id = EXTERNAL_SENSOR_TEMP_ATTR_ID ,
161
168
type = t .int16s ,
162
169
is_manufacturer_specific = True ,
163
- )
164
-
165
- valve_state = ZCLAttributeDef (
166
- id = VALVE_STATE_ATTR_ID ,
167
- type = State ,
168
- is_manufacturer_specific = True ,
170
+ access = "rwp" ,
169
171
)
170
172
171
173
actuator_type = ZCLAttributeDef (
172
174
id = ACTUATOR_TYPE_ATTR_ID ,
173
175
type = BoschActuatorType ,
174
176
is_manufacturer_specific = True ,
177
+ access = "rwp" ,
175
178
)
176
179
177
180
sensor_connection = ZCLAttributeDef (
178
181
id = SENSOR_CONNECTION_ATTR_ID ,
179
182
type = BoschSensorConnection ,
180
183
is_manufacturer_specific = True ,
184
+ access = "rwp" ,
181
185
)
182
186
183
187
@@ -187,24 +191,33 @@ class BoschUserInterfaceCluster(CustomCluster, UserInterface):
187
191
class AttributeDefs (UserInterface .AttributeDefs ):
188
192
"""Bosch user interface manufacturer specific attributes."""
189
193
194
+ temperature_display_mode = ZCLAttributeDef (
195
+ id = 0x0000 ,
196
+ type = TemperatureDisplayMode ,
197
+ access = "rwp" ,
198
+ )
199
+
190
200
display_on_time = ZCLAttributeDef (
191
201
id = SCREEN_TIMEOUT_ATTR_ID ,
192
202
# Usable values range from 5-30
193
203
type = t .enum8 ,
194
204
is_manufacturer_specific = True ,
205
+ access = "rwp" ,
195
206
)
196
207
197
208
display_brightness = ZCLAttributeDef (
198
209
id = SCREEN_BRIGHTNESS_ATTR_ID ,
199
210
# Values range from 0-10
200
211
type = t .enum8 ,
201
212
is_manufacturer_specific = True ,
213
+ access = "rwp" ,
202
214
)
203
215
204
216
valve_status_led = ZCLAttributeDef (
205
217
id = VALVE_STATUS_LED_ATTR_ID ,
206
218
type = BoschValveStatusLed ,
207
219
is_manufacturer_specific = True ,
220
+ access = "rwp" ,
208
221
)
209
222
210
223
@@ -217,15 +230,17 @@ class AttributeDefs(UserInterface.AttributeDefs):
217
230
.sensor (
218
231
BoschThermostatCluster .AttributeDefs .valve_duty_cycle .name ,
219
232
BoschThermostatCluster .cluster_id ,
233
+ entity_type = EntityType .DIAGNOSTIC ,
220
234
state_class = SensorStateClass .MEASUREMENT ,
221
235
unit = PERCENTAGE ,
222
236
translation_key = "valve_duty_cycle" ,
223
237
fallback_name = "Valve duty cycle" ,
224
238
)
225
239
# Valve state (open/closed).
226
- .sensor (
240
+ .binary_sensor (
227
241
BoschThermostatCluster .AttributeDefs .valve_state .name ,
228
242
BoschThermostatCluster .cluster_id ,
243
+ device_class = BinarySensorDeviceClass .RUNNING ,
229
244
translation_key = "valve_state" ,
230
245
fallback_name = "Valve state" ,
231
246
reporting_config = ReportingConfig (
@@ -243,7 +258,7 @@ class AttributeDefs(UserInterface.AttributeDefs):
243
258
translation_key = "external_sensor_temperature" ,
244
259
fallback_name = "External sensor temperature" ,
245
260
reporting_config = ReportingConfig (
246
- min_interval = 30 , max_interval = 900 , reportable_change = 5
261
+ min_interval = 30 , max_interval = 900 , reportable_change = 25
247
262
),
248
263
)
249
264
# Operating mode - read-only: controlled automatically through Thermostat.system_mode (HAVC mode).
@@ -366,7 +381,7 @@ class AttributeDefs(UserInterface.AttributeDefs):
366
381
translation_key = "outdoor_temperature" ,
367
382
fallback_name = "Outdoor temperature" ,
368
383
reporting_config = ReportingConfig (
369
- min_interval = 30 , max_interval = 900 , reportable_change = 5
384
+ min_interval = 30 , max_interval = 900 , reportable_change = 25
370
385
),
371
386
)
372
387
.add_to_registry ()
0 commit comments