From d47fe35a881f90b4bf35f17af018a6a118d8f24d Mon Sep 17 00:00:00 2001 From: "David F. Mulcahey" Date: Mon, 21 Nov 2022 18:02:54 -0500 Subject: [PATCH] Add config entities for lumi.motion.agl04 (#82087) --- .../components/zha/core/channels/manufacturerspecific.py | 7 ++++++- homeassistant/components/zha/number.py | 4 +++- homeassistant/components/zha/select.py | 3 ++- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/homeassistant/components/zha/core/channels/manufacturerspecific.py b/homeassistant/components/zha/core/channels/manufacturerspecific.py index c4baccf4ae6..b60df5d3706 100644 --- a/homeassistant/components/zha/core/channels/manufacturerspecific.py +++ b/homeassistant/components/zha/core/channels/manufacturerspecific.py @@ -110,6 +110,11 @@ class OppleRemote(ZigbeeChannel): "motion_sensitivity": True, "trigger_indicator": True, } + elif self.cluster.endpoint.model == "lumi.motion.agl04": + self.ZCL_INIT_ATTRS = { + "detection_interval": True, + "motion_sensitivity": True, + } elif self.cluster.endpoint.model == "lumi.motion.ac01": self.ZCL_INIT_ATTRS = { "presence": True, @@ -124,7 +129,7 @@ class OppleRemote(ZigbeeChannel): async def async_initialize_channel_specific(self, from_cache: bool) -> None: """Initialize channel specific.""" - if self.cluster.endpoint.model == "lumi.motion.ac02": + if self.cluster.endpoint.model in ("lumi.motion.ac02", "lumi.motion.agl04"): interval = self.cluster.get("detection_interval", self.cluster.get(0x0102)) if interval is not None: self.debug("Loaded detection interval at startup: %s", interval) diff --git a/homeassistant/components/zha/number.py b/homeassistant/components/zha/number.py index 853ab189bbf..8a71321c208 100644 --- a/homeassistant/components/zha/number.py +++ b/homeassistant/components/zha/number.py @@ -448,7 +448,9 @@ class ZHANumberConfigurationEntity(ZhaEntity, NumberEntity): _LOGGER.debug("read value=%s", value) -@CONFIG_DIAGNOSTIC_MATCH(channel_names="opple_cluster", models={"lumi.motion.ac02"}) +@CONFIG_DIAGNOSTIC_MATCH( + channel_names="opple_cluster", models={"lumi.motion.ac02", "lumi.motion.agl04"} +) class AqaraMotionDetectionInterval( ZHANumberConfigurationEntity, id_suffix="detection_interval" ): diff --git a/homeassistant/components/zha/select.py b/homeassistant/components/zha/select.py index 334040a2b4d..96925550676 100644 --- a/homeassistant/components/zha/select.py +++ b/homeassistant/components/zha/select.py @@ -336,7 +336,8 @@ class AqaraMotionSensitivities(types.enum8): @CONFIG_DIAGNOSTIC_MATCH( - channel_names="opple_cluster", models={"lumi.motion.ac01", "lumi.motion.ac02"} + channel_names="opple_cluster", + models={"lumi.motion.ac01", "lumi.motion.ac02", "lumi.motion.agl04"}, ) class AqaraMotionSensitivity(ZCLEnumSelectEntity, id_suffix="motion_sensitivity"): """Representation of a ZHA motion sensitivity configuration entity."""