From 4b325cf82df4c18280787a575340039014007d6a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=8D=E6=B1=82=E5=9C=A3=E5=89=91?= Date: Mon, 2 Feb 2026 15:11:03 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8DBUG?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- custom_components/jackery/sensor.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/custom_components/jackery/sensor.py b/custom_components/jackery/sensor.py index 8c5b4b0..e92465f 100644 --- a/custom_components/jackery/sensor.py +++ b/custom_components/jackery/sensor.py @@ -381,8 +381,13 @@ class JackeryDataCoordinator: combined.append(item) if isinstance(raw_cts, list): for item in raw_cts: - if isinstance(item, dict) and item.get("devType") is None: - item = {**item, "devType": 2} + 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} combined.append(item) if combined: @@ -435,6 +440,8 @@ class JackeryDataCoordinator: # Check SN key (could be 'sn' or 'deviceSn') sn = plug.get("deviceSn") or plug.get("sn") 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}")