From 2058bd161d570edd4122bb97db7c9d27c2d13887 Mon Sep 17 00:00:00 2001 From: fantandrea Date: Tue, 14 Oct 2025 23:59:40 +0200 Subject: [PATCH] add energy_monitoring quirk --- kasa/smart/smartdevice.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/kasa/smart/smartdevice.py b/kasa/smart/smartdevice.py index 87aa628d8..8f93c9b30 100644 --- a/kasa/smart/smartdevice.py +++ b/kasa/smart/smartdevice.py @@ -204,6 +204,14 @@ def _parse_components(components_raw: ComponentsRaw) -> dict[str, int]: for comp in components_raw["component_list"] } + def _enable_device_quirks(self) -> None: + # Read computed energy values for devices not having physical sensors + if "energy_monitoring" not in self._components and self.model in ["L535"]: + self._components["energy_monitoring"] = 1 + _LOGGER.debug( + "[QUIRKS] Energy monitoring enabled to read computed energy values" + ) + async def _negotiate(self) -> None: """Perform initialization. @@ -227,6 +235,7 @@ async def _negotiate(self) -> None: self._components_raw = cast(ComponentsRaw, resp["component_nego"]) self._components = self._parse_components(self._components_raw) + self._enable_device_quirks() if "child_device" in self._components and not self.children: await self._initialize_children()