Skip to content

Commit

Permalink
Add HZC D688-ZG dimmer switch quirk (#3362)
Browse files Browse the repository at this point in the history
  • Loading branch information
jagheterfredrik authored Sep 24, 2024
1 parent b858a88 commit 8145087
Show file tree
Hide file tree
Showing 2 changed files with 100 additions and 0 deletions.
1 change: 1 addition & 0 deletions zhaquirks/hzc/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
"""Module for HZC quirks implementations."""
99 changes: 99 additions & 0 deletions zhaquirks/hzc/dimmerswitch.py
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],
},
},
}

0 comments on commit 8145087

Please sign in to comment.