升级新库

This commit is contained in:
BBIT-Kai
2025-12-31 17:49:17 +08:00
parent d6c7f209c7
commit 6136554562
14 changed files with 355 additions and 356 deletions
+8 -11
View File
@@ -40,17 +40,14 @@ if sys.platform.lower() == "win32" or os.name.lower() == "nt":
def get_device_id_simple():
try:
with open("/etc/machine-id") as f:
mid = f.read().strip()
if mid:
return mid
except Exception:
pass
hostname = socket.gethostname()
mac = uuid.getnode()
mac_str = ":".join(f"{(mac >> ele) & 0xff:02x}" for ele in range(40, -1, -8))
return f"{hostname}|{mac_str}"
hostname = os.getenv("HOST_NAME")
if not hostname:
hostname = socket.gethostname()
mac = uuid.getnode()
mac_str = ":".join(f"{(mac >> ele) & 0xff:02x}" for ele in range(40, -1, -8))
return f"{hostname}|{mac_str}"
else:
return hostname
# todo 这里需要订阅状态信息 设备发送信息 这里回复 vue前端发送指令 后端发送指令 设备接收指令