From d80a2b0fa33efac5e475d715d37a6327e38b5a86 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=8D=E6=B1=82=E5=9C=A3=E5=89=91?= Date: Wed, 4 Feb 2026 10:54:52 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E5=88=A0=E9=99=A4=E8=AE=BE?= =?UTF-8?q?=E5=A4=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- custom_components/jackery/sensor.py | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/custom_components/jackery/sensor.py b/custom_components/jackery/sensor.py index 69c3b17..f37bf8a 100644 --- a/custom_components/jackery/sensor.py +++ b/custom_components/jackery/sensor.py @@ -394,20 +394,19 @@ class JackeryDataCoordinator: item = {**item, "devType": 2} combined.append(item) - if combined: - for item in combined: - if not isinstance(item, dict): - continue - dt = item.get("devType") - if dt == 2: - current_cts.append(item) - else: - current_plugs.append(item) + for item in combined: + if not isinstance(item, dict): + continue + dt = item.get("devType") + if dt == 2: + current_cts.append(item) + else: + current_plugs.append(item) - self._data_cache["cts"] = current_cts - # Store all in "plugs" for JackeryPlugSensor to find itself by SN - self._data_cache["plugs"] = combined - self._data_cache["plug"] = combined # Keep original key too + self._data_cache["cts"] = current_cts + # Store all in "plugs" for JackeryPlugSensor to find itself by SN + self._data_cache["plugs"] = combined + self._data_cache["plug"] = combined # Keep original key too # Type 25 or Status: Main device data elif isinstance(body, dict):