8000 Add device fixture for P316M(US) by TheLinuxGuy · Pull Request #1568 · python-kasa/python-kasa · GitHub
[go: up one dir, main page]

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ The following devices have been tested and confirmed as working. If your device
### Supported Tapo[^1] devices

- **Plugs**: P100, P110, P110M, P115, P125M, P135, TP10, TP15
- **Power Strips**: P210M, P300, P304M, P306, TP25
- **Power Strips**: P210M, P300, P304M, P306, P316M, TP25
- **Wall Switches**: S210, S220, S500, S500D, S505, S505D
- **Bulbs**: L510B, L510E, L530B, L530E, L535E, L630
- **Light Strips**: L900-10, L900-5, L920-5, L930-5
Expand Down
2 changes: 2 additions & 0 deletions SUPPORTED.md
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,8 @@ All Tapo devices require authentication.<br>Hub-Connected Devices may work acros
- Hardware: 1.0 (UK) / Firmware: 1.0.3
- **P306**
- Hardware: 1.0 (US) / Firmware: 1.1.2
- **P316M**
- Hardware: 1.6 (US) / Firmware: 1.0.5
- **TP25**
- Hardware: 1.0 (US) / Firmware: 1.0.2

Expand Down
9 changes: 7 additions & 2 deletions kasa/smart/modules/powerprotection.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,9 @@ def overloaded(self) -> bool:
@property
def enabled(self) -> bool:
"""Return True if child protection is enabled."""
return self.data["get_protection_power"]["enabled"]
settings = self.data["get_protection_power"]
enabled_key = next(k for k in settings if "enabled" in k)
return settings[enabled_key]

async def set_enabled(self, enabled: bool, *, threshold: int | None = None) -> dict:
"""Set power protection enabled.
Expand All @@ -73,7 +75,10 @@ async def set_enabled(self, enabled: bool, *, threshold: int | None = None) -> d
"Threshold out of range: %s (%s)", threshold, self.protection_threshold
)

params = {**self.data["get_protection_power"], "enabled": enabled}
enabled_key = next(
k for k in self.data["get_protection_power"] if "enabled" in k
)
params = {**self.data["get_protection_power"], enabled_key: enabled}
if threshold is not None:
params["protection_power"] = threshold
return await self.call("set_protection_power", params)
Expand Down
2 changes: 1 addition & 1 deletion tests/device_fixtures.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@
}
SWITCHES = {*SWITCHES_IOT, *SWITCHES_SMART}
STRIPS_IOT = {"HS107", "HS300", "KP303", "KP200", "KP400", "EP40"}
STRIPS_SMART = {"P300", "P304M", "TP25", "EP40M", "P210M", "P306"}
STRIPS_SMART = {"P300", "P304M", "TP25", "EP40M", "P210M", "P306", "P316M"}
STRIPS = {*STRIPS_IOT, *STRIPS_SMART}

DIMMERS_IOT = {"ES20M", "HS220", "KS220", "KS220M", "KS230", "KP405"}
Expand Down
Loading
Loading
0