8000 Rename to consumables & cleanup code · python-kasa/python-kasa@405fc50 · GitHub
[go: up one dir, main page]

Skip to content
Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 405fc50

Browse files
committed
Rename to consumables & cleanup code
1 parent 365bb3e commit 405fc50

File tree

4 files changed

+10
-12
lines changed

4 files changed

+10
-12
lines changed

SUPPORTED.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,6 @@ All Tapo devices require authentication.<br>Hub-Connected Devices may work acros
295295
- **H100**
296296
- Hardware: 1.0 (EU) / Firmware: 1.2.3
297297
- Hardware: 1.0 (EU) / Firmware: 1.5.10
298-
- Hardware: 1.0 (EU) / Firmware: 1.5.20
299298
- Hardware: 1.0 (EU) / Firmware: 1.5.5
300299
- **H200**
301300
- Hardware: 1.0 (EU) / Firmware: 1.3.2

kasa/module.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,7 @@ class Module(ABC):
163163

164164
# Vacuum modules
165165
Clean: Final[ModuleName[smart.Clean]] = ModuleName("Clean")
166+
Consumables: Final[ModuleName[smart.Consumables]] = ModuleName("Consumables")
166167
Dustbin: Final[ModuleName[smart.Dustbin]] = ModuleName("Dustbin")
167168
Speaker: Final[ModuleName[smart.Speaker]] = ModuleName("Speaker")
168169
Mop: Final[ModuleName[smart.Mop]] = ModuleName("Mop")

kasa/smart/modules/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
from .cloud import Cloud
1212
from .color import Color
1313
from .colortemperature import ColorTemperature
14+
from .consumables import Consumables
1415
from .contactsensor import ContactSensor
1516
from .devicemodule import DeviceModule
1617
from .dustbin import Dustbin
@@ -37,7 +38,6 @@
3738
from .thermostat import Thermostat
3839
from .time import Time
3940
from .triggerlogs import TriggerLogs
40-
from .vacuumconsumables import VacuumConsumables
4141
from .waterleaksensor import WaterleakSensor
4242

4343
__all__ = [
@@ -72,7 +72,7 @@
7272
"FrostProtection",
7373
"Thermostat",
7474
"Clean",
75-
"VacuumConsumables",
75+
"Consumables",
7676
"SmartLightEffect",
7777
"OverheatProtection",
7878
"Speaker",

kasa/smart/modules/vacuumconsumables.py renamed to kasa/smart/modules/consumables.py

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ class Consumable:
2727

2828

2929
CONSUMABLES = [
30-
# TODO: there is also main_brush_lid_time
3130
Consumable(
3231
"Main brush",
3332< 8000 div class="diff-text-inner"> feature_basename="main_brush",
@@ -54,16 +53,15 @@ class Consumable:
5453
),
5554
Consumable(
5655
"Charging contacts",
57-
feature_basename="contacts",
56+
feature_basename="charging_contacts",
5857
data_key="charge_contact_time",
5958
lifetime=timedelta(hours=30),
6059
),
61-
# unknown data, does not seem to be mop used
62-
# Consumable("Rag", key="rag_time", lifetime=timedelta(hours=30))
60+
# Unknown keys: main_brush_lid_time, rag_time
6361
]
6462

6563

66-
class VacuumConsumables(SmartModule):
64+
class Consumables(SmartModule):
6765
"""Implementation of vacuum consumables."""
6866

6967
REQUIRED_COMPONENT = "consumables"
@@ -92,7 +90,7 @@ def _initialize_features(self) -> None:
9290
self._add_feature(
9391
Feature(
9492
self._device,
95-
id=f"vacuum_{consumable.feature_basename}_remaining",
93+
id=f"{consumable.feature_basename}_remaining",
9694
name=f"{consumable.name} remaining",
9795
container=self.data,
9896
attribute_getter=lambda container, item=consumable: item.lifetime
@@ -105,13 +103,13 @@ def _initialize_features(self) -> None:
105103
self._add_feature(
106104
Feature(
107105
self._device,
108-
id=f"vacuum_{consumable.feature_basename}_reset",
109-
name=f"Reset {consumable.name}",
106+
id=f"{consumable.feature_basename}_reset",
107+
name=f"Reset {consumable.name.lower()} consumable",
110108
container=self.data,
111109
attribute_setter=lambda _, item=consumable: self.reset_consumable(
112110
item
113111
),
114-
category=Feature.Category.Info,
112+
category=Feature.Category.Debug,
115113
type=Feature.Type.Action,
116114
)
117115
)

0 commit comments

Comments
 (0)
0