1
- from zigpy .quirks .v2 import BinarySensorDeviceClass , EntityPlatform , EntityType
2
- from zhaquirks .tuya .builder import TuyaQuirkBuilder
3
- from zhaquirks .const import BatterySize
1
+ """Tuya Plantation Shutter."""
2
+
3
+ from zigpy .quirks .v2 import EntityPlatform , EntityType
4
+ from zigpy .quirks .v2 .homeassistant import PERCENTAGE
4
5
import zigpy .types as t
5
- from zigpy .quirks .v2 .homeassistant import (
6
- PERCENTAGE ,
7
- UnitOfElectricPotential ,
8
- UnitOfTime ,
9
- UnitOfVolume ,
10
- )
6
+
7
+ from zhaquirks .tuya .builder import TuyaQuirkBuilder
8
+
11
9
12
10
class OpeningStateEnum (t .enum8 ):
13
11
"""Enum for opening state."""
@@ -17,17 +15,30 @@ class OpeningStateEnum(t.enum8):
17
15
Close = 0x02
18
16
Continue = 0x03
19
17
20
- #class SituationSetEnum(t.enum8):
21
- # """Enum for Situation Set."""
22
- #
23
- # fully_open = 0
24
- # fully_close = 1
25
18
26
- #class MotorDirectionEnum(t.enum8):
27
- # """Enum for Motor Direction."""
28
- #
29
- # Forward = 0
30
- # Backward = 1
19
+ class SituationSetEnum (t .enum8 ):
20
+ """Enum for Situation Set."""
21
+
22
+ fully_open = 0x00
23
+ fully_close = 0x01
24
+
25
+
26
+ class MotorDirectionEnum (t .enum8 ):
27
+ """Enum for Motor Direction."""
28
+
29
+ Forward = 0x00
30
+ Backward = 0x01
31
+
32
+
33
+ class BorderLimitEnum (t .enum8 ):
34
+ """Enum for Border Limit Setting."""
35
+
36
+ up = 0x00
37
+ down = 0x01
38
+ up_delete = 0x02
39
+ down_delete = 0x03
40
+ remove_top_bottom = 0x04
41
+
31
42
32
43
(
33
44
TuyaQuirkBuilder ("_TZE284_myikb7qz" , "TS0601" )
@@ -40,6 +51,7 @@ class OpeningStateEnum(t.enum8):
40
51
translation_key = "control" ,
41
52
fallback_name = "Control" ,
42
53
)
54
+ # Working
43
55
.tuya_number (
44
56
dp_id = 2 ,
45
57
attribute_name = "curtain_target_setting" ,
@@ -51,6 +63,7 @@ class OpeningStateEnum(t.enum8):
51
63
translation_key = "curtain_target_setting" ,
52
64
fallback_name = "Curtain Target Setting" ,
53
65
)
66
+ # Working
54
67
.tuya_number (
55
68
dp_id = 3 ,
56
69
attribute_name = "curtain_postion" ,
@@ -62,32 +75,58 @@ class OpeningStateEnum(t.enum8):
62
75
translation_key = "curtain_position" ,
63
76
fallback_name = "Curtain Position" ,
64
77
)
65
- #.tuya_enum(
66
- # dp_id=5,
67
- # attribute_name="motor_direction",
68
- # enum_class=MotorDirectionEnum,
69
- # entity_type=EntityType.STANDARD,
70
- # entity_platform=EntityPlatform.SENSOR,
71
- # translation_key="motor_direction",
72
- # fallback_name="Motor Direction",
73
- #)
74
- #.tuya_enum(
75
- # dp_id=11,
76
- # attribute_name="situation_set",
77
- # enum_class=SituationSetEnum,
78
- # entity_type=EntityType.STANDARD,
79
- # entity_platform=EntityPlatform.SENSOR,
80
- # translation_key="situation_set",
81
- # fallback_name="Situation Set",
82
- #)
83
- .tuya_battery (dp_id = 13 , battery_qty = 1 )
84
- #.tuya_switch(
85
- # dp_id=101,
86
- # attribute_name="child_lock",
87
- # translation_key="child_lock",
88
- # fallback_name="Child lock",
89
- #)
78
+ # Working Needs to be manually triggered to pick up sensor
79
+ .tuya_enum (
80
+ dp_id = 5 ,
81
+ attribute_name = "motor_direction" ,
82
+ enum_class = MotorDirectionEnum ,
83
+ entity_type = EntityType .STANDARD ,
84
+ entity_platform = EntityPlatform .SENSOR ,
85
+ translation_key = "motor_direction" ,
86
+ fallback_name = "Motor Direction" ,
87
+ )
88
+ # Not Working
89
+ .tuya_enum (
90
+ dp_id = 11 ,
91
+ attribute_name = "situation_set" ,
92
+ enum_class = SituationSetEnum ,
93
+ entity_type = EntityType .STANDARD ,
94
+ entity_platform = EntityPlatform .SENSOR ,
95
+ translation_key = "situation_set" ,
96
+ fallback_name = "Situation Set" ,
97
+ )
98
+ # power_cfg=PowerConfiguration does not work
99
+ .tuya_battery (
100
+ dp_id = 13 ,
101
+ )
102
+ # Not working
103
+ .tuya_enum (
104
+ dp_id = 16 ,
105
+ attribute_name = "border_limit" ,
106
+ enum_class = BorderLimitEnum ,
107
+ entity_type = EntityType .STANDARD ,
108
+ entity_platform = EntityPlatform .SENSOR ,
109
+ translation_key = "border_limit" ,
110
+ fallback_name = "Border Limit Setting" ,
111
+ )
112
+ # Not working
113
+ .tuya_number (
114
+ dp_id = 19 ,
115
+ attribute_name = "position_best" ,
116
+ type = t .uint32_t ,
117
+ min_value = 0 ,
118
+ max_value = 100 ,
119
+ step = 1 ,
120
+ unit = PERCENTAGE ,
121
+ translation_key = "position_best" ,
122
+ fallback_name = "Best Position" ,
123
+ )
124
+ .tuya_switch (
125
+ dp_id = 101 ,
126
+ attribute_name = "child_lock" ,
127
+ translation_key = "child_lock" ,
128
+ fallback_name = "Child lock" ,
129
+ )
90
130
.skip_configuration ()
91
131
.add_to_registry ()
92
132
)
93
-
0 commit comments