From 406b9022555ba8f1f3babb3333340b8c74518a0c Mon Sep 17 00:00:00 2001 From: makefu Date: Thu, 25 Apr 2024 00:13:03 +0200 Subject: shack/glados: use working quirk for ts011f source: https://github.com/zigpy/zha-device-handlers/issues/1764#issuecomment-1946842958 --- krebs/2configs/shack/glados/default.nix | 5 +-- .../zigbee-quirks/ts011f_power_monitoring.py | 52 +++++++++------------- 2 files changed, 23 insertions(+), 34 deletions(-) (limited to 'krebs') diff --git a/krebs/2configs/shack/glados/default.nix b/krebs/2configs/shack/glados/default.nix index ecf9ef48a..e8ed18f0d 100644 --- a/krebs/2configs/shack/glados/default.nix +++ b/krebs/2configs/shack/glados/default.nix @@ -10,9 +10,6 @@ in { image = "homeassistant/home-assistant:latest"; environment = { TZ = "Europe/Berlin"; - # TODO create unique users - PUID = toString config.users.users.news_container.uid; - PGID = toString config.users.groups.news_container.gid; UMASK = "007"; }; extraOptions = ["--net=host" "--device=/dev/zigbee" ]; @@ -25,7 +22,7 @@ in { systemd.tmpfiles.rules = [ #"f ${confdir}/docker-run 0770 kiosk kiosk - -" # TODO: - "d ${confdir} 0770 news_container news_container - -" + "d ${confdir} 0770 root root - -" ]; services.nginx.virtualHosts."hass.shack" = { diff --git a/krebs/2configs/shack/glados/zigbee-quirks/ts011f_power_monitoring.py b/krebs/2configs/shack/glados/zigbee-quirks/ts011f_power_monitoring.py index 51ca139bc..b520fe947 100644 --- a/krebs/2configs/shack/glados/zigbee-quirks/ts011f_power_monitoring.py +++ b/krebs/2configs/shack/glados/zigbee-quirks/ts011f_power_monitoring.py @@ -1,6 +1,7 @@ """TS011F plug.""" from zigpy.profiles import zgp, zha +from zigpy.quirks import CustomDevice from zigpy.zcl.clusters.general import ( Basic, GreenPowerProxy, @@ -13,6 +14,7 @@ from zigpy.zcl.clusters.general import ( ) from zigpy.zcl.clusters.homeautomation import ElectricalMeasurement from zigpy.zcl.clusters.lightlink import LightLink +from zigpy.zcl.clusters.measurement import TemperatureMeasurement from zigpy.zcl.clusters.smartenergy import Metering from zhaquirks.const import ( @@ -24,24 +26,35 @@ from zhaquirks.const import ( OUTPUT_CLUSTERS, PROFILE_ID, ) +from zhaquirks.quirk_ids import TUYA_PLUG_ONOFF from zhaquirks.tuya import ( + EnchantedDevice, + TuyaNewManufCluster, + TuyaZB1888Cluster, TuyaZBE000Cluster, TuyaZBElectricalMeasurement, + TuyaZBExternalSwitchTypeCluster, + TuyaZBMeteringCluster, TuyaZBMeteringClusterWithUnit, TuyaZBOnOffAttributeCluster, ) -from zhaquirks.tuya.mcu import EnchantedDevice +class Plug_v2l(EnchantedDevice): + """Another TS011F Tuya plug. First one using this definition is _TZ3000_okaz9tjs.""" -class Plug_v3(EnchantedDevice): - """Tuya TS011F plug. One plug is _Tz3000_0Zfrhq4I.""" + quirk_id = TUYA_PLUG_ONOFF signature = { MODEL: "TS011F", ENDPOINTS: { + # "profile_id": 260, + # "device_type": "0x0100", + # "in_clusters": ["0x0000", "0x0003", "0x0004", "0x0005", "0x0006", "0x0702", "0x0b04", "0xe001"], + # "in_clusters": ["0x0000", "0x0003", "0x0004", "0x0005", "0x0006", "0x000a", "0x0702", "0x0b04", "0x1000", "0xe000", "0xe001"], + # "out_clusters": [] 1: { PROFILE_ID: zha.PROFILE_ID, - DEVICE_TYPE: zha.DeviceType.SMART_PLUG, + DEVICE_TYPE: zha.DeviceType.ON_OFF_LIGHT, INPUT_CLUSTERS: [ Basic.cluster_id, Identify.cluster_id, @@ -52,24 +65,13 @@ class Plug_v3(EnchantedDevice): Metering.cluster_id, ElectricalMeasurement.cluster_id, LightLink.cluster_id, - 0x1888, TuyaZBE000Cluster.cluster_id, + TuyaZBExternalSwitchTypeCluster.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, - ], + OUTPUT_CLUSTERS: [], }, }, } - replacement = { ENDPOINTS: { 1: { @@ -85,20 +87,10 @@ class Plug_v3(EnchantedDevice): 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, + TuyaZBE000Cluster.cluster_id, + TuyaZBExternalSwitchTypeCluster, ], + OUTPUT_CLUSTERS: [], }, }, } -- cgit v1.2.3