Skip to content

Instantly share code, notes, and snippets.

@agners
Created April 29, 2023 07:14
Show Gist options
  • Save agners/c7faae845fd8109f958e3d9350d4591b to your computer and use it in GitHub Desktop.
Save agners/c7faae845fd8109f958e3d9350d4591b to your computer and use it in GitHub Desktop.
ZHA custom device (quirk) to override GL-C-006P warm-white/cold-white color temperature
"""GLEDOPTO GL-C-006P device."""
from zigpy.profiles import zha
from zigpy.quirks import CustomDevice
from zigpy.zcl.clusters.general import (
Basic,
GreenPowerProxy,
Groups,
Identify,
LevelControl,
OnOff,
Ota,
Scenes,
)
from zigpy.zcl.clusters.lighting import Color
from zigpy.zcl.clusters.lightlink import LightLink
from zhaquirks import CustomCluster
from zhaquirks.const import (
DEVICE_TYPE,
ENDPOINTS,
INPUT_CLUSTERS,
MODELS_INFO,
OUTPUT_CLUSTERS,
PROFILE_ID,
)
class GLC006P(CustomDevice):
"""Gledopto GL-C-006P (mini) custom device implementation to customize color temperature."""
class CustomColorCluster(CustomCluster, Color):
"""Color Cluster."""
_CONSTANT_ATTRIBUTES = {0x400B: 154, 0x400C: 370}
signature = {
MODELS_INFO: [("GLEDOPTO", "GL-C-006P")],
ENDPOINTS: {
1: {
PROFILE_ID: zha.PROFILE_ID,
DEVICE_TYPE: zha.DeviceType.COLOR_TEMPERATURE_LIGHT,
INPUT_CLUSTERS: [
Basic.cluster_id,
Identify.cluster_id,
Groups.cluster_id,
Scenes.cluster_id,
OnOff.cluster_id,
LevelControl.cluster_id,
Color.cluster_id,
LightLink.cluster_id,
],
OUTPUT_CLUSTERS: [
Ota.cluster_id,
],
},
242: {
PROFILE_ID: 41440,
DEVICE_TYPE: 0x0061,
INPUT_CLUSTERS: [],
OUTPUT_CLUSTERS: [
GreenPowerProxy.cluster_id,
],
},
},
}
replacement = {
ENDPOINTS: {
1: {
PROFILE_ID: zha.PROFILE_ID,
DEVICE_TYPE: zha.DeviceType.COLOR_TEMPERATURE_LIGHT,
INPUT_CLUSTERS: [
Basic.cluster_id,
Identify.cluster_id,
Groups.cluster_id,
Scenes.cluster_id,
OnOff.cluster_id,
LevelControl.cluster_id,
CustomColorCluster,
LightLink.cluster_id,
],
OUTPUT_CLUSTERS: [
Ota.cluster_id,
],
},
242: {
PROFILE_ID: 41440,
DEVICE_TYPE: 0x0061,
INPUT_CLUSTERS: [],
OUTPUT_CLUSTERS: [
GreenPowerProxy.cluster_id,
],
},
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment