From f9a126a0ecdba9b774ec04d62377c915c4b058fe Mon Sep 17 00:00:00 2001 From: bullitt168 Date: Thu, 23 Oct 2025 22:15:57 +0200 Subject: [PATCH 1/2] fixed battery temp sensor fail --- e3dc/_e3dc.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/e3dc/_e3dc.py b/e3dc/_e3dc.py index e888ec0..8e561dc 100644 --- a/e3dc/_e3dc.py +++ b/e3dc/_e3dc.py @@ -1568,7 +1568,11 @@ def get_battery_data( ): temperatures_data = rscpFindTagIndex(temperatures_raw, RscpTag.BAT_DATA) sensorCount = rscpFindTagIndex(info, RscpTag.BAT_DCB_NR_SENSOR) - for sensor in range(0, sensorCount): + + # As sensorCount can return bigger values than we have actual temperatures_data, + # we use the smaller count for robustness. + sensors = min(sensorCount, len(temperatures_data)) + for sensor in range(0, sensors): temperatures.append(temperatures_data[sensor][2]) # Set voltages, if available for the device From 18fbb865f0a8c365170867c2e885748554938099 Mon Sep 17 00:00:00 2001 From: bullitt168 Date: Sat, 25 Oct 2025 14:12:03 +0200 Subject: [PATCH 2/2] fixed black formatter error --- e3dc/_e3dc.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/e3dc/_e3dc.py b/e3dc/_e3dc.py index 8e561dc..62faa0d 100644 --- a/e3dc/_e3dc.py +++ b/e3dc/_e3dc.py @@ -1568,7 +1568,7 @@ def get_battery_data( ): temperatures_data = rscpFindTagIndex(temperatures_raw, RscpTag.BAT_DATA) sensorCount = rscpFindTagIndex(info, RscpTag.BAT_DCB_NR_SENSOR) - + # As sensorCount can return bigger values than we have actual temperatures_data, # we use the smaller count for robustness. sensors = min(sensorCount, len(temperatures_data))