Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add HZC D688-ZG dimmer switch quirk #3362

Merged
merged 3 commits into from
Sep 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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],
},
},
}
Loading