-
Notifications
You must be signed in to change notification settings - Fork 688
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add HZC D688-ZG dimmer switch quirk (#3362)
- Loading branch information
1 parent
b858a88
commit 8145087
Showing
2 changed files
with
100 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
"""Module for HZC quirks implementations.""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
"""Quirk for HZC Dimmer-Switch-ZB3.0 (e.g. D688-ZG).""" | ||
|
||
from zigpy.profiles import zgp, zha | ||
from zigpy.quirks import CustomCluster, CustomDevice | ||
from zigpy.zcl.clusters.general import ( | ||
Basic, | ||
GreenPowerProxy, | ||
Groups, | ||
Identify, | ||
LevelControl, | ||
OnOff, | ||
Ota, | ||
Scenes, | ||
) | ||
from zigpy.zcl.clusters.homeautomation import Diagnostic | ||
from zigpy.zcl.clusters.lightlink import LightLink | ||
|
||
from zhaquirks import NoReplyMixin | ||
from zhaquirks.const import ( | ||
DEVICE_TYPE, | ||
ENDPOINTS, | ||
INPUT_CLUSTERS, | ||
MODELS_INFO, | ||
OUTPUT_CLUSTERS, | ||
PROFILE_ID, | ||
) | ||
|
||
|
||
class HzcOnOff(NoReplyMixin, CustomCluster, OnOff): | ||
"""HZC On Off Cluster.""" | ||
|
||
void_input_commands = {cmd.id for cmd in OnOff.commands_by_name.values()} | ||
|
||
|
||
class DimmerSwitch(CustomDevice): | ||
"""Dimmer-Switch-ZB3.0 by HZC / Shyugj.""" | ||
|
||
signature = { | ||
MODELS_INFO: [ | ||
("HZC", "Dimmer-Switch-ZB3.0"), | ||
("Shyugj", "Dimmer-Switch-ZB3.0"), | ||
], | ||
ENDPOINTS: { | ||
1: { | ||
# <SimpleDescriptor endpoint=1 profile=260 device_type=257 | ||
# input_clusters=[0, 3, 4, 5, 6, 8, 2821, 4096] | ||
# output_clusters=[25]> | ||
PROFILE_ID: zha.PROFILE_ID, | ||
DEVICE_TYPE: zha.DeviceType.DIMMABLE_LIGHT, | ||
INPUT_CLUSTERS: [ | ||
Basic.cluster_id, | ||
Identify.cluster_id, | ||
Groups.cluster_id, | ||
Scenes.cluster_id, | ||
OnOff.cluster_id, | ||
LevelControl.cluster_id, | ||
Diagnostic.cluster_id, | ||
LightLink.cluster_id, | ||
], | ||
OUTPUT_CLUSTERS: [Ota.cluster_id], | ||
}, | ||
242: { | ||
# <SimpleDescriptor endpoint=242 profile=41440 device_type=97 | ||
# input_clusters=[] | ||
# output_clusters=[33] | ||
PROFILE_ID: zgp.PROFILE_ID, | ||
DEVICE_TYPE: zgp.DeviceType.PROXY_BASIC, | ||
INPUT_CLUSTERS: [], | ||
OUTPUT_CLUSTERS: [ | ||
GreenPowerProxy.cluster_id, | ||
], | ||
}, | ||
}, | ||
} | ||
replacement = { | ||
ENDPOINTS: { | ||
1: { | ||
PROFILE_ID: zha.PROFILE_ID, | ||
DEVICE_TYPE: zha.DeviceType.DIMMABLE_LIGHT, | ||
INPUT_CLUSTERS: [ | ||
Basic.cluster_id, | ||
Identify.cluster_id, | ||
Groups.cluster_id, | ||
Scenes.cluster_id, | ||
HzcOnOff, # OnOff.cluster_id, | ||
LevelControl.cluster_id, | ||
Diagnostic.cluster_id, | ||
LightLink.cluster_id, | ||
], | ||
OUTPUT_CLUSTERS: [Ota.cluster_id], | ||
}, | ||
242: { | ||
PROFILE_ID: zgp.PROFILE_ID, | ||
DEVICE_TYPE: zgp.DeviceType.PROXY_BASIC, | ||
INPUT_CLUSTERS: [], | ||
OUTPUT_CLUSTERS: [GreenPowerProxy.cluster_id], | ||
}, | ||
}, | ||
} |