Remove SmartPlug in favor of SmartDevice (#781)

With the move towards autodetecting available features, there is no reason to keep SmartPlug around.

kasa.smart.SmartPlug is removed in favor of kasa.smart.SmartDevice which offers the same functionality.
Information about auto_off can be accessed using Features of the AutoOffModule on supported devices.

Co-authored-by: Steven B. <51370195+sdb9696@users.noreply.github.com>
This commit is contained in:
Teemu R
2024-02-22 14:34:55 +01:00
committed by GitHub
parent 8c39e81a40
commit d9d2f1a430
10 changed files with 70 additions and 61 deletions

View File

@@ -20,7 +20,7 @@ from kasa import (
)
from kasa.iot import IotBulb, IotDimmer, IotLightStrip, IotPlug, IotStrip
from kasa.protocol import BaseTransport
from kasa.smart import SmartBulb, SmartPlug
from kasa.smart import SmartBulb, SmartDevice
from kasa.xortransport import XorEncryption
from .fakeprotocol_iot import FakeIotProtocol
@@ -108,7 +108,6 @@ PLUGS_SMART = {
"EP25",
"KS205",
"P125M",
"P135",
"S505",
"TP15",
}
@@ -121,7 +120,7 @@ STRIPS_SMART = {"P300", "TP25"}
STRIPS = {*STRIPS_IOT, *STRIPS_SMART}
DIMMERS_IOT = {"ES20M", "HS220", "KS220M", "KS230", "KP405"}
DIMMERS_SMART = {"S500D"}
DIMMERS_SMART = {"S500D", "P135"}
DIMMERS = {
*DIMMERS_IOT,
*DIMMERS_SMART,
@@ -346,7 +345,7 @@ def device_for_file(model, protocol):
if protocol == "SMART":
for d in PLUGS_SMART:
if d in model:
return SmartPlug
return SmartDevice
for d in BULBS_SMART:
if d in model:
return SmartBulb
@@ -355,7 +354,7 @@ def device_for_file(model, protocol):
return SmartBulb
for d in STRIPS_SMART:
if d in model:
return SmartPlug
return SmartDevice
else:
for d in STRIPS_IOT:
if d in model: