diff --git a/krebs/2configs/shack/glados/default.nix b/krebs/2configs/shack/glados/default.nix index 23921c23e..ecf9ef48a 100644 --- a/krebs/2configs/shack/glados/default.nix +++ b/krebs/2configs/shack/glados/default.nix @@ -18,6 +18,7 @@ in { extraOptions = ["--net=host" "--device=/dev/zigbee" ]; volumes = [ "${confdir}:/config" + "${./zigbee-quirks}:/quirks" #"${confdir}/docker-run:/etc/services.d/home-assistant/run:" ]; }; diff --git a/krebs/2configs/shack/glados/zigbee-quirks/__init__.py b/krebs/2configs/shack/glados/zigbee-quirks/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/krebs/2configs/shack/glados/zigbee-quirks/ts011f_power_monitoring.py b/krebs/2configs/shack/glados/zigbee-quirks/ts011f_power_monitoring.py new file mode 100644 index 000000000..51ca139bc --- /dev/null +++ b/krebs/2configs/shack/glados/zigbee-quirks/ts011f_power_monitoring.py @@ -0,0 +1,104 @@ +"""TS011F plug.""" + +from zigpy.profiles import zgp, zha +from zigpy.zcl.clusters.general import ( + Basic, + GreenPowerProxy, + Groups, + Identify, + OnOff, + Ota, + Scenes, + Time, +) +from zigpy.zcl.clusters.homeautomation import ElectricalMeasurement +from zigpy.zcl.clusters.lightlink import LightLink +from zigpy.zcl.clusters.smartenergy import Metering + +from zhaquirks.const import ( + DEVICE_TYPE, + ENDPOINTS, + INPUT_CLUSTERS, + MODEL, + MODELS_INFO, + OUTPUT_CLUSTERS, + PROFILE_ID, +) +from zhaquirks.tuya import ( + TuyaZBE000Cluster, + TuyaZBElectricalMeasurement, + TuyaZBMeteringClusterWithUnit, + TuyaZBOnOffAttributeCluster, +) +from zhaquirks.tuya.mcu import EnchantedDevice + + +class Plug_v3(EnchantedDevice): + """Tuya TS011F plug. One plug is _Tz3000_0Zfrhq4I.""" + + signature = { + MODEL: "TS011F", + ENDPOINTS: { + 1: { + PROFILE_ID: zha.PROFILE_ID, + DEVICE_TYPE: zha.DeviceType.SMART_PLUG, + INPUT_CLUSTERS: [ + Basic.cluster_id, + Identify.cluster_id, + Groups.cluster_id, + Scenes.cluster_id, + OnOff.cluster_id, + Time.cluster_id, + Metering.cluster_id, + ElectricalMeasurement.cluster_id, + LightLink.cluster_id, + 0x1888, + TuyaZBE000Cluster.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, + ], + }, + }, + } + + replacement = { + ENDPOINTS: { + 1: { + PROFILE_ID: zha.PROFILE_ID, + DEVICE_TYPE: zha.DeviceType.SMART_PLUG, + INPUT_CLUSTERS: [ + Basic.cluster_id, + Identify.cluster_id, + Groups.cluster_id, + Scenes.cluster_id, + TuyaZBOnOffAttributeCluster, + Time.cluster_id, + TuyaZBMeteringClusterWithUnit, + TuyaZBElectricalMeasurement, + LightLink.cluster_id, + 0x1888, + TuyaZBE000Cluster, + ], + OUTPUT_CLUSTERS: [ + Ota.cluster_id, + ], + }, + 242: { + PROFILE_ID: zgp.PROFILE_ID, + DEVICE_TYPE: zgp.DeviceType.PROXY_BASIC, + INPUT_CLUSTERS: [], + OUTPUT_CLUSTERS: [ + GreenPowerProxy.cluster_id, + ], + }, + }, + }