python-swidget 1.4.8__tar.gz → 1.4.9__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.9}/PKG-INFO +1 -1
- {python_swidget-1.4.8 → python_swidget-1.4.9}/pyproject.toml +1 -1
- {python_swidget-1.4.8 → python_swidget-1.4.9}/swidget/swidgetdevice.py +21 -1
- {python_swidget-1.4.8 → python_swidget-1.4.9}/README.md +0 -0
- {python_swidget-1.4.8 → python_swidget-1.4.9}/swidget/__init__.py +0 -0
- {python_swidget-1.4.8 → python_swidget-1.4.9}/swidget/cli.py +0 -0
- {python_swidget-1.4.8 → python_swidget-1.4.9}/swidget/discovery.py +0 -0
- {python_swidget-1.4.8 → python_swidget-1.4.9}/swidget/exceptions.py +0 -0
- {python_swidget-1.4.8 → python_swidget-1.4.9}/swidget/provision.py +0 -0
- {python_swidget-1.4.8 → python_swidget-1.4.9}/swidget/py.typed +0 -0
- {python_swidget-1.4.8 → python_swidget-1.4.9}/swidget/swidgetdimmer.py +0 -0
- {python_swidget-1.4.8 → python_swidget-1.4.9}/swidget/swidgetoutlet.py +0 -0
- {python_swidget-1.4.8 → python_swidget-1.4.9}/swidget/swidgetswitch.py +0 -0
- {python_swidget-1.4.8 → python_swidget-1.4.9}/swidget/swidgettimerswitch.py +0 -0
- {python_swidget-1.4.8 → python_swidget-1.4.9}/swidget/websocket.py +0 -0
|
@@ -361,10 +361,30 @@ class SwidgetDevice:
|
|
|
361
361
|
self.model = summary["model"]
|
|
362
362
|
self.mac_address = summary["mac"]
|
|
363
363
|
self.version = summary["version"]
|
|
364
|
-
|
|
364
|
+
new_assemblies = {
|
|
365
365
|
"host": SwidgetAssembly(summary["host"]),
|
|
366
366
|
"insert": SwidgetAssembly(summary["insert"]),
|
|
367
367
|
}
|
|
368
|
+
# Carry already-populated function state forward. Rebuilding
|
|
369
|
+
# assemblies wholesale resets every component's ``functions`` to
|
|
370
|
+
# ``None`` placeholders until the next ``state`` message lands —
|
|
371
|
+
# subscribers that read state in between (e.g. an HA coordinator
|
|
372
|
+
# firing on the summary callback) would briefly see "unknown"
|
|
373
|
+
# and flicker the UI.
|
|
374
|
+
for assembly_key, new_assembly in new_assemblies.items():
|
|
375
|
+
old_assembly = self.assemblies.get(assembly_key)
|
|
376
|
+
if old_assembly is None:
|
|
377
|
+
continue
|
|
378
|
+
for component_id, new_component in new_assembly.components.items():
|
|
379
|
+
old_component = old_assembly.components.get(component_id)
|
|
380
|
+
if old_component is None:
|
|
381
|
+
continue
|
|
382
|
+
for fn_name in new_component.functions:
|
|
383
|
+
if fn_name in old_component.functions:
|
|
384
|
+
new_component.functions[fn_name] = old_component.functions[
|
|
385
|
+
fn_name
|
|
386
|
+
]
|
|
387
|
+
self.assemblies = new_assemblies
|
|
368
388
|
self.device_type = DeviceType(self.assemblies["host"].type)
|
|
369
389
|
self.insert_type = InsertType(self.assemblies["insert"].type)
|
|
370
390
|
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
|