mirror of
https://github.com/python-kasa/python-kasa.git
synced 2025-01-08 22:07:06 +00:00
Bind consumable on lambda def
This commit is contained in:
parent
43de201d84
commit
330763bc83
@ -81,8 +81,8 @@ class VacuumConsumables(SmartModule):
|
|||||||
id=f"vacuum_{consumable.feature_basename}_used",
|
id=f"vacuum_{consumable.feature_basename}_used",
|
||||||
name=f"{consumable.name} used",
|
name=f"{consumable.name} used",
|
||||||
container=self.data,
|
container=self.data,
|
||||||
attribute_getter=lambda container: timedelta(
|
attribute_getter=lambda container, item=consumable: timedelta(
|
||||||
minutes=getattr(container, consumable.data_key)
|
minutes=getattr(container, item.data_key)
|
||||||
),
|
),
|
||||||
category=Feature.Category.Debug,
|
category=Feature.Category.Debug,
|
||||||
type=Feature.Type.Sensor,
|
type=Feature.Type.Sensor,
|
||||||
@ -95,8 +95,8 @@ class VacuumConsumables(SmartModule):
|
|||||||
id=f"vacuum_{consumable.feature_basename}_remaining",
|
id=f"vacuum_{consumable.feature_basename}_remaining",
|
||||||
name=f"{consumable.name} remaining",
|
name=f"{consumable.name} remaining",
|
||||||
container=self.data,
|
container=self.data,
|
||||||
attribute_getter=lambda container: consumable.lifetime
|
attribute_getter=lambda container, item=consumable: item.lifetime
|
||||||
- timedelta(minutes=getattr(container, consumable.data_key)),
|
- timedelta(minutes=getattr(container, item.data_key)),
|
||||||
category=Feature.Category.Info,
|
category=Feature.Category.Info,
|
||||||
type=Feature.Type.Sensor,
|
type=Feature.Type.Sensor,
|
||||||
)
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user