From 486984fff81df7ec3a032ff8cff6503fd9854326 Mon Sep 17 00:00:00 2001 From: "Teemu R." Date: Fri, 18 Oct 2024 12:31:52 +0200 Subject: [PATCH] Add motion sensor to known categories (#1176) Also, improve device type warning on unknown devices --- kasa/smart/smartchilddevice.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/kasa/smart/smartchilddevice.py b/kasa/smart/smartchilddevice.py index 16006ea4..1fe0014e 100644 --- a/kasa/smart/smartchilddevice.py +++ b/kasa/smart/smartchilddevice.py @@ -26,6 +26,7 @@ class SmartChildDevice(SmartDevice): "subg.trigger.contact-sensor": DeviceType.Sensor, "subg.trigger.temp-hmdt-sensor": DeviceType.Sensor, "subg.trigger.water-leak-sensor": DeviceType.Sensor, + "subg.trigger.motion-sensor": DeviceType.Sensor, "kasa.switch.outlet.sub-fan": DeviceType.Fan, "kasa.switch.outlet.sub-dimmer": DeviceType.Dimmer, "subg.trv": DeviceType.Thermostat, @@ -87,9 +88,14 @@ class SmartChildDevice(SmartDevice): @property def device_type(self) -> DeviceType: """Return child device type.""" - dev_type = self.CHILD_DEVICE_TYPE_MAP.get(self.sys_info["category"]) + category = self.sys_info["category"] + dev_type = self.CHILD_DEVICE_TYPE_MAP.get(category) if dev_type is None: - _LOGGER.warning("Unknown child device type, please open issue ") + _LOGGER.warning( + "Unknown child device type %s for model %s, please open issue", + category, + self.model, + ) dev_type = DeviceType.Unknown return dev_type