From 370aa5f4e457f38b5db7572b45789989e9dc8916 Mon Sep 17 00:00:00 2001 From: Teemu Rytilahti Date: Mon, 2 Dec 2024 13:50:06 +0100 Subject: [PATCH] Add reset consumable --- kasa/smart/modules/vacuumconsumables.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/kasa/smart/modules/vacuumconsumables.py b/kasa/smart/modules/vacuumconsumables.py index aaa0306d..1eae58e8 100644 --- a/kasa/smart/modules/vacuumconsumables.py +++ b/kasa/smart/modules/vacuumconsumables.py @@ -101,3 +101,24 @@ class VacuumConsumables(SmartModule): type=Feature.Type.Sensor, ) ) + + self._add_feature( + Feature( + self._device, + id=f"vacuum_{consumable.feature_basename}_reset", + name=f"Reset {consumable.name}", + container=self.data, + attribute_setter=lambda _, item=consumable: self.reset_consumable( + item + ), + category=Feature.Category.Info, + type=Feature.Type.Action, + ) + ) + + async def reset_consumable(self, consumable: Consumable) -> dict: + """Reset consumable stats.""" + consumable_name = consumable.data_key.removesuffix("_time") + return await self.call( + "resetConsumablesTime", {"reset_list": [consumable_name]} + )