55from zigpy .quirks .v2 .homeassistant import PERCENTAGE , EntityType , UnitOfTemperature
66from zigpy .quirks .v2 .homeassistant .number import NumberDeviceClass
77from zigpy .quirks .v2 .homeassistant .sensor import SensorStateClass
8+ from zigpy .quirks .v2 .homeassistant .binary_sensor import BinarySensorDeviceClass
89import zigpy .types as t
910from zigpy .zcl .clusters .hvac import TemperatureDisplayMode , Thermostat , UserInterface
1011from zigpy .zcl .foundation import ZCLAttributeDef
@@ -123,61 +124,64 @@ class AttributeDefs(Thermostat.AttributeDefs):
123124 id = OPERATING_MODE_ATTR_ID ,
124125 type = BoschOperatingMode ,
125126 is_manufacturer_specific = True ,
127+ access = "rwp" ,
126128 )
127129
128130 valve_duty_cycle = ZCLAttributeDef (
129131 id = VALVE_DUTY_CYCLE_ATTR_ID ,
130132 # Values range from 0-100
131133 type = t .uint8_t ,
132134 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" ,
133143 )
134144
135145 window_open = ZCLAttributeDef (
136146 id = WINDOW_OPEN_ATTR_ID ,
137147 type = State ,
138148 is_manufacturer_specific = True ,
149+ access = "rwp" ,
139150 )
140151
141152 boost_heating = ZCLAttributeDef (
142153 id = BOOST_HEATING_ATTR_ID ,
143154 type = State ,
144155 is_manufacturer_specific = True ,
145- )
146-
147- temperature_display_mode = ZCLAttributeDef (
148- id = 0x0000 ,
149- type = TemperatureDisplayMode ,
150- access = "rw" ,
156+ access = "rwp" ,
151157 )
152158
153159 outdoor_temperature = ZCLAttributeDef (
154160 id = OUTDOOR_TEMP_ATTR_ID ,
155161 type = t .int16s ,
156162 is_manufacturer_specific = True ,
163+ access = "rwp" ,
157164 )
158165
159166 external_sensor_temperature = ZCLAttributeDef (
160167 id = EXTERNAL_SENSOR_TEMP_ATTR_ID ,
161168 type = t .int16s ,
162169 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" ,
169171 )
170172
171173 actuator_type = ZCLAttributeDef (
172174 id = ACTUATOR_TYPE_ATTR_ID ,
173175 type = BoschActuatorType ,
174176 is_manufacturer_specific = True ,
177+ access = "rwp" ,
175178 )
176179
177180 sensor_connection = ZCLAttributeDef (
178181 id = SENSOR_CONNECTION_ATTR_ID ,
179182 type = BoschSensorConnection ,
180183 is_manufacturer_specific = True ,
184+ access = "rwp" ,
181185 )
182186
183187
@@ -187,24 +191,33 @@ class BoschUserInterfaceCluster(CustomCluster, UserInterface):
187191 class AttributeDefs (UserInterface .AttributeDefs ):
188192 """Bosch user interface manufacturer specific attributes."""
189193
194+ temperature_display_mode = ZCLAttributeDef (
195+ id = 0x0000 ,
196+ type = TemperatureDisplayMode ,
197+ access = "rwp" ,
198+ )
199+
190200 display_on_time = ZCLAttributeDef (
191201 id = SCREEN_TIMEOUT_ATTR_ID ,
192202 # Usable values range from 5-30
193203 type = t .enum8 ,
194204 is_manufacturer_specific = True ,
205+ access = "rwp" ,
195206 )
196207
197208 display_brightness = ZCLAttributeDef (
198209 id = SCREEN_BRIGHTNESS_ATTR_ID ,
199210 # Values range from 0-10
200211 type = t .enum8 ,
201212 is_manufacturer_specific = True ,
213+ access = "rwp" ,
202214 )
203215
204216 valve_status_led = ZCLAttributeDef (
205217 id = VALVE_STATUS_LED_ATTR_ID ,
206218 type = BoschValveStatusLed ,
207219 is_manufacturer_specific = True ,
220+ access = "rwp" ,
208221 )
209222
210223
@@ -217,15 +230,17 @@ class AttributeDefs(UserInterface.AttributeDefs):
217230 .sensor (
218231 BoschThermostatCluster .AttributeDefs .valve_duty_cycle .name ,
219232 BoschThermostatCluster .cluster_id ,
233+ entity_type = EntityType .DIAGNOSTIC ,
220234 state_class = SensorStateClass .MEASUREMENT ,
221235 unit = PERCENTAGE ,
222236 translation_key = "valve_duty_cycle" ,
223237 fallback_name = "Valve duty cycle" ,
224238 )
225239 # Valve state (open/closed).
226- .sensor (
240+ .binary_sensor (
227241 BoschThermostatCluster .AttributeDefs .valve_state .name ,
228242 BoschThermostatCluster .cluster_id ,
243+ device_class = BinarySensorDeviceClass .RUNNING ,
229244 translation_key = "valve_state" ,
230245 fallback_name = "Valve state" ,
231246 reporting_config = ReportingConfig (
@@ -243,7 +258,7 @@ class AttributeDefs(UserInterface.AttributeDefs):
243258 translation_key = "external_sensor_temperature" ,
244259 fallback_name = "External sensor temperature" ,
245260 reporting_config = ReportingConfig (
246- min_interval = 30 , max_interval = 900 , reportable_change = 5
261+ min_interval = 30 , max_interval = 900 , reportable_change = 25
247262 ),
248263 )
249264 # Operating mode - On/Pause automatically from HVAC mode, Schedule/Manual configured here.
@@ -366,7 +381,7 @@ class AttributeDefs(UserInterface.AttributeDefs):
366381 translation_key = "outdoor_temperature" ,
367382 fallback_name = "Outdoor temperature" ,
368383 reporting_config = ReportingConfig (
369- min_interval = 30 , max_interval = 900 , reportable_change = 5
384+ min_interval = 30 , max_interval = 900 , reportable_change = 25
370385 ),
371386 )
372387 .add_to_registry ()
0 commit comments