11"""Senoro Window Sensor (TS0601)."""
22
33from zigpy .quirks .v2 import BinarySensorDeviceClass , EntityPlatform , EntityType
4+ from zigpy .quirks .v2 .homeassistant import UnitOfTime
45import zigpy .types as t
56from zigpy .zcl import foundation
67
7- from zigpy .quirks .v2 .homeassistant import UnitOfTime
88from zhaquirks .tuya import TUYA_CLUSTER_ID , BatterySize
99from zhaquirks .tuya .builder import TuyaQuirkBuilder
1010
@@ -16,6 +16,7 @@ class OpeningStateEnum(t.enum8):
1616 Closed = 1
1717 Tilted = 2
1818
19+
1920(
2021 TuyaQuirkBuilder ("_TZE200_ytx9fudw" , "TS0601" )
2122 .tuya_battery (
@@ -126,9 +127,9 @@ class OpeningStateEnum(t.enum8):
126127 dp_id = 103 ,
127128 attribute_name = "alarm_siren" ,
128129 type = t .Bool ,
129- access = foundation .ZCLAttributeAccess .Read |
130- foundation .ZCLAttributeAccess .Write |
131- foundation .ZCLAttributeAccess .Report ,
130+ access = foundation .ZCLAttributeAccess .Read
131+ | foundation .ZCLAttributeAccess .Write
132+ | foundation .ZCLAttributeAccess .Report ,
132133 )
133134 .switch (
134135 attribute_name = "alarm_siren" ,
@@ -139,50 +140,49 @@ class OpeningStateEnum(t.enum8):
139140 fallback_name = "Use Alarm Siren" ,
140141 )
141142 .tuya_number (
142- dp_id = 109 ,
143- attribute_name = "alarm_siren_duration" ,
143+ dp_id = 109 ,
144+ attribute_name = "alarm_siren_duration" ,
144145 type = t .uint16_t ,
145- min_value = 5 ,
146- max_value = 180 ,
146+ min_value = 5 ,
147+ max_value = 180 ,
147148 unit = UnitOfTime .SECONDS ,
148- step = 1 ,
149- fallback_name = "Alarm Siren Duration" ,
150- translation_key = "alarm_siren_duration"
149+ step = 1 ,
150+ fallback_name = "Alarm Siren Duration" ,
151+ translation_key = "alarm_siren_duration" ,
151152 )
152153 .tuya_dp_attribute (
153- dp_id = 102 ,
154- attribute_name = "vibration" ,
154+ dp_id = 102 ,
155+ attribute_name = "vibration" ,
155156 type = t .uint16_t ,
156- access = foundation .ZCLAttributeAccess .Read |
157- foundation .ZCLAttributeAccess .Report
157+ access = foundation .ZCLAttributeAccess .Read
158+ | foundation .ZCLAttributeAccess .Report ,
158159 )
159160 .tuya_number (
160- dp_id = 106 ,
161- attribute_name = "vibration_limit" ,
161+ dp_id = 106 ,
162+ attribute_name = "vibration_limit" ,
162163 type = t .uint16_t ,
163- min_value = 0 ,
164- max_value = 100 ,
165- step = 1 ,
166- fallback_name = "Value of vibration." ,
167- translation_key = "vibration_limit"
164+ min_value = 0 ,
165+ max_value = 100 ,
166+ step = 1 ,
167+ fallback_name = "Value of vibration." ,
168+ translation_key = "vibration_limit" ,
168169 )
169170 .tuya_number (
170- dp_id = 110 ,
171- attribute_name = "vibration_siren_duration" ,
171+ dp_id = 110 ,
172+ attribute_name = "vibration_siren_duration" ,
172173 type = t .uint16_t ,
173- min_value = 5 ,
174- max_value = 180 ,
174+ min_value = 5 ,
175+ max_value = 180 ,
175176 unit = UnitOfTime .SECONDS ,
176- step = 1 ,
177- fallback_name = "Duration of the vibrating siren." ,
178- translation_key = "vibration_siren_duration"
177+ step = 1 ,
178+ fallback_name = "Duration of the vibrating siren." ,
179+ translation_key = "vibration_siren_duration" ,
179180 )
180181 .tuya_dp_attribute (
181- dp_id = 108 ,
182- attribute_name = "vibration_siren" ,
182+ dp_id = 108 ,
183+ attribute_name = "vibration_siren" ,
183184 type = t .Bool ,
184- access = foundation .ZCLAttributeAccess .Read |
185- foundation .ZCLAttributeAccess .Write
185+ access = foundation .ZCLAttributeAccess .Read | foundation .ZCLAttributeAccess .Write ,
186186 )
187187 .switch (
188188 attribute_name = "vibration_siren" ,
@@ -192,11 +192,11 @@ class OpeningStateEnum(t.enum8):
192192 fallback_name = "Activate the siren when vibrating." ,
193193 )
194194 .tuya_dp_attribute (
195- dp_id = 104 ,
196- attribute_name = "close_signal" ,
195+ dp_id = 104 ,
196+ attribute_name = "close_signal" ,
197197 type = t .Bool ,
198- access = foundation .ZCLAttributeAccess .Read |
199- foundation . ZCLAttributeAccess . Write )
198+ access = foundation .ZCLAttributeAccess .Read | foundation . ZCLAttributeAccess . Write ,
199+ )
200200 .switch (
201201 attribute_name = "close_signal" ,
202202 cluster_id = TUYA_CLUSTER_ID ,
@@ -205,30 +205,32 @@ class OpeningStateEnum(t.enum8):
205205 fallback_name = "Enable sound when closing the window." ,
206206 )
207207 .tuya_number (
208- dp_id = 105 ,
209- attribute_name = "transmission_power" ,
208+ dp_id = 105 ,
209+ attribute_name = "transmission_power" ,
210210 type = t .uint8_t ,
211- min_value = 11 ,
212- max_value = 19 ,
213- step = 1 ,
214- fallback_name = "Transmission power 11-19. High value > battery consumption." ,
215- translation_key = "transmission_power"
216- )
211+ min_value = 11 ,
212+ max_value = 19 ,
213+ step = 1 ,
214+ fallback_name = "Transmission power 11-19. High value > battery consumption." ,
215+ translation_key = "transmission_power" ,
216+ )
217217 .tuya_dp_attribute (
218- dp_id = 111 ,
218+ dp_id = 111 ,
219219 attribute_name = "magnetic_status" ,
220220 type = t .Bool ,
221221 converter = lambda value : not value ,
222222 dp_converter = lambda value : not value ,
223- access = foundation .ZCLAttributeAccess .Read |
224- foundation .ZCLAttributeAccess .Report )
225- .binary_sensor (attribute_name = "magnetic_status" ,
223+ access = foundation .ZCLAttributeAccess .Read
224+ | foundation .ZCLAttributeAccess .Report ,
225+ )
226+ .binary_sensor (
227+ attribute_name = "magnetic_status" ,
226228 cluster_id = TUYA_CLUSTER_ID ,
227229 entity_type = EntityType .STANDARD ,
228- device_class = BinarySensorDeviceClass .DOOR ,
230+ device_class = BinarySensorDeviceClass .DOOR ,
229231 translation_key = "magnetic_status" ,
230- fallback_name = "Magnetic status."
232+ fallback_name = "Magnetic status." ,
231233 )
232- .skip_configuration ()
234+ .skip_configuration ()
233235 .add_to_registry ()
234- )
236+ )
0 commit comments