From 330763bc83fce49a91387f1124f32fb395bc0923 Mon Sep 17 00:00:00 2001 From: Teemu Rytilahti Date: Sun, 1 Dec 2024 01:45:14 +0100 Subject: [PATCH] Bind consumable on lambda def --- kasa/smart/modules/vacuumconsumables.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/kasa/smart/modules/vacuumconsumables.py b/kasa/smart/modules/vacuumconsumables.py index 24485bc8..49544067 100644 --- a/kasa/smart/modules/vacuumconsumables.py +++ b/kasa/smart/modules/vacuumconsumables.py @@ -81,8 +81,8 @@ class VacuumConsumables(SmartModule): id=f"vacuum_{consumable.feature_basename}_used", name=f"{consumable.name} used", container=self.data, - attribute_getter=lambda container: timedelta( - minutes=getattr(container, consumable.data_key) + attribute_getter=lambda container, item=consumable: timedelta( + minutes=getattr(container, item.data_key) ), category=Feature.Category.Debug, type=Feature.Type.Sensor, @@ -95,8 +95,8 @@ class VacuumConsumables(SmartModule): id=f"vacuum_{consumable.feature_basename}_remaining", name=f"{consumable.name} remaining", container=self.data, - attribute_getter=lambda container: consumable.lifetime - - timedelta(minutes=getattr(container, consumable.data_key)), + attribute_getter=lambda container, item=consumable: item.lifetime + - timedelta(minutes=getattr(container, item.data_key)), category=Feature.Category.Info, type=Feature.Type.Sensor, )