Skip to content

Commit c06b3bf

Browse files
authored
Add device automation support for Sunricher ZGRC-KEY-004 (#4402)
1 parent e41ab9d commit c06b3bf

File tree

2 files changed

+31
-0
lines changed

2 files changed

+31
-0
lines changed

zhaquirks/sunricher/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
"""Module for Sunricher devices."""

zhaquirks/sunricher/button.py

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
"""Sunricher Button device."""
2+
3+
from zigpy.quirks.v2 import QuirkBuilder
4+
5+
from zhaquirks.const import (
6+
COMMAND,
7+
COMMAND_MOVE_ON_OFF,
8+
COMMAND_OFF,
9+
COMMAND_ON,
10+
COMMAND_STOP_ON_OFF,
11+
LONG_PRESS,
12+
LONG_RELEASE,
13+
RIGHT,
14+
SHORT_PRESS,
15+
TURN_OFF,
16+
TURN_ON,
17+
)
18+
19+
(
20+
QuirkBuilder("Sunricher", "ZGRC-KEY-004")
21+
.device_automation_triggers(
22+
{
23+
(SHORT_PRESS, TURN_ON): {COMMAND: COMMAND_ON},
24+
(SHORT_PRESS, TURN_OFF): {COMMAND: COMMAND_OFF},
25+
(LONG_PRESS, RIGHT): {COMMAND: COMMAND_MOVE_ON_OFF},
26+
(LONG_RELEASE, RIGHT): {COMMAND: COMMAND_STOP_ON_OFF},
27+
}
28+
)
29+
.add_to_registry()
30+
)

0 commit comments

Comments
 (0)