python-swidget 1.4.3__tar.gz → 1.4.5__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {python_swidget-1.4.3 → python_swidget-1.4.5}/PKG-INFO +1 -1
- {python_swidget-1.4.3 → python_swidget-1.4.5}/pyproject.toml +1 -1
- {python_swidget-1.4.3 → python_swidget-1.4.5}/swidget/discovery.py +1 -1
- {python_swidget-1.4.3 → python_swidget-1.4.5}/swidget/swidgetdevice.py +17 -2
- {python_swidget-1.4.3 → python_swidget-1.4.5}/README.md +0 -0
- {python_swidget-1.4.3 → python_swidget-1.4.5}/swidget/__init__.py +0 -0
- {python_swidget-1.4.3 → python_swidget-1.4.5}/swidget/cli.py +0 -0
- {python_swidget-1.4.3 → python_swidget-1.4.5}/swidget/exceptions.py +0 -0
- {python_swidget-1.4.3 → python_swidget-1.4.5}/swidget/provision.py +0 -0
- {python_swidget-1.4.3 → python_swidget-1.4.5}/swidget/py.typed +0 -0
- {python_swidget-1.4.3 → python_swidget-1.4.5}/swidget/swidgetdimmer.py +0 -0
- {python_swidget-1.4.3 → python_swidget-1.4.5}/swidget/swidgetoutlet.py +0 -0
- {python_swidget-1.4.3 → python_swidget-1.4.5}/swidget/swidgetswitch.py +0 -0
- {python_swidget-1.4.3 → python_swidget-1.4.5}/swidget/swidgettimerswitch.py +0 -0
- {python_swidget-1.4.3 → python_swidget-1.4.5}/swidget/websocket.py +0 -0
|
@@ -159,7 +159,7 @@ async def discover_single(
|
|
|
159
159
|
|
|
160
160
|
def _get_device_class(device_type: DeviceType) -> Type[SwidgetDevice]:
|
|
161
161
|
"""Find SmartDevice subclass for device described by passed data."""
|
|
162
|
-
if device_type
|
|
162
|
+
if device_type in (DeviceType.Outlet, DeviceType.Outlet20A):
|
|
163
163
|
return SwidgetOutlet
|
|
164
164
|
elif device_type == DeviceType.Switch:
|
|
165
165
|
return SwidgetSwitch
|
|
@@ -26,11 +26,21 @@ class DeviceType(Enum):
|
|
|
26
26
|
|
|
27
27
|
Dimmer = "dimmer"
|
|
28
28
|
Outlet = "outlet"
|
|
29
|
+
Outlet20A = "outlet_20a"
|
|
29
30
|
Switch = "switch"
|
|
30
31
|
TimerSwitch = "pana_switch"
|
|
31
32
|
RelaySwitch = "relay_switch"
|
|
32
33
|
Unknown = -1
|
|
33
34
|
|
|
35
|
+
@classmethod
|
|
36
|
+
def _missing_(cls, value: object) -> "DeviceType":
|
|
37
|
+
"""Map unknown values to ``Unknown`` instead of raising ValueError.
|
|
38
|
+
|
|
39
|
+
Lets the SDK report "Unknown device type: ..." with a usable
|
|
40
|
+
message rather than crashing on a future firmware variant.
|
|
41
|
+
"""
|
|
42
|
+
return cls.Unknown
|
|
43
|
+
|
|
34
44
|
|
|
35
45
|
class InsertType(Enum):
|
|
36
46
|
"""Insert type enum."""
|
|
@@ -46,6 +56,11 @@ class InsertType(Enum):
|
|
|
46
56
|
WD = "WATER DETECTOR"
|
|
47
57
|
Unknown = -1
|
|
48
58
|
|
|
59
|
+
@classmethod
|
|
60
|
+
def _missing_(cls, value: object) -> "InsertType":
|
|
61
|
+
"""Map unknown values to ``Unknown`` instead of raising ValueError."""
|
|
62
|
+
return cls.Unknown
|
|
63
|
+
|
|
49
64
|
|
|
50
65
|
class SelfDiagnosticErrorCodes(Enum):
|
|
51
66
|
"""Self-Diagnostic error codes."""
|
|
@@ -707,8 +722,8 @@ class SwidgetDevice:
|
|
|
707
722
|
|
|
708
723
|
@property
|
|
709
724
|
def is_outlet(self) -> bool:
|
|
710
|
-
"""Return True if the device is an outlet."""
|
|
711
|
-
return self.device_type
|
|
725
|
+
"""Return True if the device is an outlet (any variant)."""
|
|
726
|
+
return self.device_type in (DeviceType.Outlet, DeviceType.Outlet20A)
|
|
712
727
|
|
|
713
728
|
@property
|
|
714
729
|
def is_switch(self) -> bool:
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|