summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormakefu <github@syntax-fehler.de>2024-04-24 23:49:22 +0200
committermakefu <github@syntax-fehler.de>2024-04-24 23:58:28 +0200
commit190db40330c87a8e69a718255090ec9c2957aabd (patch)
treed388284eb4d1dabc663910bebff8d90b08cd6658
parent658f5c74a3203f231dde5bd04e24ea3a56547db1 (diff)
glados: mount ts011f quirks into home-assistant container
-rw-r--r--krebs/2configs/shack/glados/default.nix1
-rw-r--r--krebs/2configs/shack/glados/zigbee-quirks/__init__.py0
-rw-r--r--krebs/2configs/shack/glados/zigbee-quirks/ts011f_power_monitoring.py104
3 files changed, 105 insertions, 0 deletions
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
--- /dev/null
+++ b/krebs/2configs/shack/glados/zigbee-quirks/__init__.py
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,
+ ],
+ },
+ },
+ }