python-swidget 1.4.8__tar.gz → 1.4.10__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.8 → python_swidget-1.4.10}/PKG-INFO +1 -1
- {python_swidget-1.4.8 → python_swidget-1.4.10}/pyproject.toml +1 -1
- {python_swidget-1.4.8 → python_swidget-1.4.10}/swidget/swidgetdevice.py +70 -8
- {python_swidget-1.4.8 → python_swidget-1.4.10}/README.md +0 -0
- {python_swidget-1.4.8 → python_swidget-1.4.10}/swidget/__init__.py +0 -0
- {python_swidget-1.4.8 → python_swidget-1.4.10}/swidget/cli.py +0 -0
- {python_swidget-1.4.8 → python_swidget-1.4.10}/swidget/discovery.py +0 -0
- {python_swidget-1.4.8 → python_swidget-1.4.10}/swidget/exceptions.py +0 -0
- {python_swidget-1.4.8 → python_swidget-1.4.10}/swidget/provision.py +0 -0
- {python_swidget-1.4.8 → python_swidget-1.4.10}/swidget/py.typed +0 -0
- {python_swidget-1.4.8 → python_swidget-1.4.10}/swidget/swidgetdimmer.py +0 -0
- {python_swidget-1.4.8 → python_swidget-1.4.10}/swidget/swidgetoutlet.py +0 -0
- {python_swidget-1.4.8 → python_swidget-1.4.10}/swidget/swidgetswitch.py +0 -0
- {python_swidget-1.4.8 → python_swidget-1.4.10}/swidget/swidgettimerswitch.py +0 -0
- {python_swidget-1.4.8 → python_swidget-1.4.10}/swidget/websocket.py +0 -0
|
@@ -22,14 +22,34 @@ _LOGGER = logging.getLogger(__name__)
|
|
|
22
22
|
|
|
23
23
|
|
|
24
24
|
class DeviceType(Enum):
|
|
25
|
-
"""Device type enum.
|
|
25
|
+
"""Device type enum.
|
|
26
|
+
|
|
27
|
+
Values mirror the host ``type`` strings documented in
|
|
28
|
+
``swidget-sdk/docs/summary_description.md``. Add new entries here
|
|
29
|
+
when firmware introduces a new host type rather than letting it
|
|
30
|
+
silently resolve to ``Unknown``.
|
|
31
|
+
"""
|
|
26
32
|
|
|
27
33
|
Dimmer = "dimmer"
|
|
34
|
+
MultiDimmer = "multi_dimmer"
|
|
28
35
|
Outlet = "outlet"
|
|
29
36
|
Outlet20A = "outlet_20a"
|
|
30
37
|
Switch = "switch"
|
|
31
38
|
TimerSwitch = "pana_switch"
|
|
32
39
|
RelaySwitch = "relay_switch"
|
|
40
|
+
PesnaFV05 = "pesna_fv05"
|
|
41
|
+
PesnaFV15 = "pesna_fv15"
|
|
42
|
+
PesnaFV20 = "pesna_fv20"
|
|
43
|
+
PesnaIB150 = "pesna_IB150"
|
|
44
|
+
PesnaIB160 = "pesna_IB160"
|
|
45
|
+
PesnaFV05G5 = "pesna_fv05_G5"
|
|
46
|
+
PesnaFV05WrongSlot = "pesna_fv05_wrong_slot"
|
|
47
|
+
PesnaUnrecognized = "pesna_unrecognized"
|
|
48
|
+
PesnaError = "pesna_error"
|
|
49
|
+
Alarm = "alarm"
|
|
50
|
+
XE300 = "xe300"
|
|
51
|
+
MalmosetBarrel = "malmoset_barrel"
|
|
52
|
+
Invalid = "invalid"
|
|
33
53
|
Unknown = -1
|
|
34
54
|
|
|
35
55
|
@classmethod
|
|
@@ -43,17 +63,39 @@ class DeviceType(Enum):
|
|
|
43
63
|
|
|
44
64
|
|
|
45
65
|
class InsertType(Enum):
|
|
46
|
-
"""Insert type enum.
|
|
66
|
+
"""Insert type enum.
|
|
67
|
+
|
|
68
|
+
Values mirror the insert ``type`` strings documented in
|
|
69
|
+
``swidget-sdk/docs/summary_description.md``. Add new entries here
|
|
70
|
+
when firmware introduces a new insert type rather than letting it
|
|
71
|
+
silently resolve to ``Unknown``.
|
|
72
|
+
"""
|
|
47
73
|
|
|
74
|
+
CONTROL = "control"
|
|
48
75
|
USB = "USB"
|
|
49
|
-
|
|
50
|
-
TH = "TEMP HUMI"
|
|
51
|
-
AQ = "AIR QUALITY"
|
|
76
|
+
USB_C = "USB C"
|
|
52
77
|
GL = "GUIDE LIGHT"
|
|
78
|
+
ADV_GUIDE = "ADV GUIDE"
|
|
53
79
|
PO = "POWER OUT"
|
|
54
|
-
|
|
55
|
-
|
|
80
|
+
MOTION = "MOTION"
|
|
81
|
+
AQ = "AIR QUALITY"
|
|
82
|
+
TH = "TEMP HUMI"
|
|
83
|
+
THM = "TEMP HUMI MOTION"
|
|
84
|
+
ENVIRONMENTAL = "ENVIRONMENTAL"
|
|
85
|
+
SECURITY = "SECURITY"
|
|
86
|
+
CO2 = "CO2"
|
|
87
|
+
PM = "PM"
|
|
88
|
+
PM_CO2 = "PM CO2"
|
|
56
89
|
WD = "WATER DETECTOR"
|
|
90
|
+
LIGHT_SENSOR = "LIGHT SENSOR"
|
|
91
|
+
DISTANCE = "DISTANCE"
|
|
92
|
+
DIRECT_LIGHTS = "DIRECT LIGHTS"
|
|
93
|
+
DUAL_LV_RELAY = "DUAL LV RELAY"
|
|
94
|
+
SINGLE_LV_RELAY = "SINGLE LV RELAY"
|
|
95
|
+
SAS = "SAS"
|
|
96
|
+
SPEAKER = "SPEAKER"
|
|
97
|
+
VIDEO = "video" # This is not a mistake.
|
|
98
|
+
INVALID = "invalid"
|
|
57
99
|
Unknown = -1
|
|
58
100
|
|
|
59
101
|
@classmethod
|
|
@@ -361,10 +403,30 @@ class SwidgetDevice:
|
|
|
361
403
|
self.model = summary["model"]
|
|
362
404
|
self.mac_address = summary["mac"]
|
|
363
405
|
self.version = summary["version"]
|
|
364
|
-
|
|
406
|
+
new_assemblies = {
|
|
365
407
|
"host": SwidgetAssembly(summary["host"]),
|
|
366
408
|
"insert": SwidgetAssembly(summary["insert"]),
|
|
367
409
|
}
|
|
410
|
+
# Carry already-populated function state forward. Rebuilding
|
|
411
|
+
# assemblies wholesale resets every component's ``functions`` to
|
|
412
|
+
# ``None`` placeholders until the next ``state`` message lands —
|
|
413
|
+
# subscribers that read state in between (e.g. an HA coordinator
|
|
414
|
+
# firing on the summary callback) would briefly see "unknown"
|
|
415
|
+
# and flicker the UI.
|
|
416
|
+
for assembly_key, new_assembly in new_assemblies.items():
|
|
417
|
+
old_assembly = self.assemblies.get(assembly_key)
|
|
418
|
+
if old_assembly is None:
|
|
419
|
+
continue
|
|
420
|
+
for component_id, new_component in new_assembly.components.items():
|
|
421
|
+
old_component = old_assembly.components.get(component_id)
|
|
422
|
+
if old_component is None:
|
|
423
|
+
continue
|
|
424
|
+
for fn_name in new_component.functions:
|
|
425
|
+
if fn_name in old_component.functions:
|
|
426
|
+
new_component.functions[fn_name] = old_component.functions[
|
|
427
|
+
fn_name
|
|
428
|
+
]
|
|
429
|
+
self.assemblies = new_assemblies
|
|
368
430
|
self.device_type = DeviceType(self.assemblies["host"].type)
|
|
369
431
|
self.insert_type = InsertType(self.assemblies["insert"].type)
|
|
370
432
|
self.id = self.assemblies["host"].id
|
|
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
|
|
File without changes
|