Skip to content

Commit a5a00d9

Browse files
fgschTheJulianJES
andauthored
Add initial Sonoff smart water valve quirk (#3346)
Co-authored-by: TheJulianJES <[email protected]>
1 parent 0bb47ae commit a5a00d9

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed

zhaquirks/sonoff/swv.py

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
"""Sonoff SWV - Zigbee smart water valve."""
2+
3+
from zigpy.quirks import CustomCluster
4+
from zigpy.quirks.v2 import QuirkBuilder
5+
import zigpy.types as t
6+
from zigpy.zcl.foundation import BaseAttributeDefs, ZCLAttributeDef
7+
8+
9+
class ValveState(t.enum8):
10+
"""Water valve state."""
11+
12+
Normal = 0
13+
Water_Shortage = 1
14+
Water_Leakage = 2
15+
Water_Shortage_And_Leakage = 3
16+
17+
18+
class EwelinkCluster(CustomCluster):
19+
"""Ewelink specific cluster."""
20+
21+
cluster_id = 0xFC11
22+
23+
class AttributeDefs(BaseAttributeDefs):
24+
"""Attribute definitions."""
25+
26+
water_valve_state = ZCLAttributeDef(
27+
id=0x500C,
28+
type=ValveState,
29+
)
30+
31+
@property
32+
def _is_manuf_specific(self):
33+
return False
34+
35+
36+
(
37+
QuirkBuilder("SONOFF", "SWV")
38+
.replaces(EwelinkCluster)
39+
.add_to_registry()
40+
) # fmt: skip

0 commit comments

Comments
 (0)