修复BUG

This commit is contained in:
不求圣剑
2026-02-02 15:11:03 +08:00
parent c5fae742f3
commit 4b325cf82d

View File

@@ -381,7 +381,12 @@ class JackeryDataCoordinator:
combined.append(item) combined.append(item)
if isinstance(raw_cts, list): if isinstance(raw_cts, list):
for item in raw_cts: for item in raw_cts:
if isinstance(item, dict) and item.get("devType") is None: if isinstance(item, dict):
# Some CT payloads report devType=3, subType=2; normalize to devType=2
sub_type = item.get("subType")
if sub_type == 2:
item = {**item, "devType": 2}
elif item.get("devType") is None:
item = {**item, "devType": 2} item = {**item, "devType": 2}
combined.append(item) combined.append(item)
@@ -435,6 +440,8 @@ class JackeryDataCoordinator:
# Check SN key (could be 'sn' or 'deviceSn') # Check SN key (could be 'sn' or 'deviceSn')
sn = plug.get("deviceSn") or plug.get("sn") sn = plug.get("deviceSn") or plug.get("sn")
dev_type = plug.get("devType") dev_type = plug.get("devType")
if dev_type is None and plug.get("subType") == 2:
dev_type = 2
# _LOGGER.debug(f"Checking sub-device: SN={sn}, Type={dev_type}") # _LOGGER.debug(f"Checking sub-device: SN={sn}, Type={dev_type}")