majordom-zigbee 0.1.2__py3-none-any.whl
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.
- majordom_zigbee/__init__.py +9 -0
- majordom_zigbee/_serial.py +20 -0
- majordom_zigbee/controller.py +724 -0
- majordom_zigbee/exceptions.py +16 -0
- majordom_zigbee/listener.py +24 -0
- majordom_zigbee/mapper.py +144 -0
- majordom_zigbee/model.py +44 -0
- majordom_zigbee/py.typed +0 -0
- majordom_zigbee/readme.md +58 -0
- majordom_zigbee/zigbee_spec.py +240 -0
- majordom_zigbee-0.1.2.dist-info/METADATA +120 -0
- majordom_zigbee-0.1.2.dist-info/RECORD +14 -0
- majordom_zigbee-0.1.2.dist-info/WHEEL +4 -0
- majordom_zigbee-0.1.2.dist-info/licenses/LICENSE +177 -0
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"""Zigbee integration for MajorDom.
|
|
2
|
+
|
|
3
|
+
Bridges Zigbee devices into the MajorDom language via zigpy. `ZigBeeController` is the entry
|
|
4
|
+
point the Hub (or the SDK's standalone dev runner) instantiates and drives.
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
from majordom_zigbee.controller import ZigBeeController
|
|
8
|
+
|
|
9
|
+
__all__ = ["ZigBeeController"]
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import subprocess
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
def port_holder(port: str) -> str:
|
|
5
|
+
"""Return human-readable description of which process holds the port, or empty string."""
|
|
6
|
+
try:
|
|
7
|
+
# fuser prints the device name to stderr, PIDs to stdout — capture separately
|
|
8
|
+
result = subprocess.run(["fuser", port], capture_output=True, text=True)
|
|
9
|
+
out = result.stdout.strip()
|
|
10
|
+
pids = [p for p in out.split() if p.isdigit()]
|
|
11
|
+
names = []
|
|
12
|
+
for pid in pids:
|
|
13
|
+
try:
|
|
14
|
+
comm = subprocess.check_output(["cat", f"/proc/{pid}/comm"], text=True).strip()
|
|
15
|
+
names.append(f"pid={pid} ({comm})")
|
|
16
|
+
except (subprocess.CalledProcessError, FileNotFoundError):
|
|
17
|
+
names.append(f"pid={pid}")
|
|
18
|
+
return ", ".join(names)
|
|
19
|
+
except (subprocess.CalledProcessError, FileNotFoundError):
|
|
20
|
+
return ""
|