We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 3ad1b55 commit 0276725Copy full SHA for 0276725
e3dc/_e3dc.py
@@ -1568,7 +1568,11 @@ def get_battery_data(
1568
):
1569
temperatures_data = rscpFindTagIndex(temperatures_raw, RscpTag.BAT_DATA)
1570
sensorCount = rscpFindTagIndex(info, RscpTag.BAT_DCB_NR_SENSOR)
1571
- for sensor in range(0, sensorCount):
+
1572
+ # As sensorCount can return bigger values than we have actual temperatures_data,
1573
+ # we use the smaller count for robustness.
1574
+ sensors = min(sensorCount, len(temperatures_data))
1575
+ for sensor in range(0, sensors):
1576
temperatures.append(temperatures_data[sensor][2])
1577
1578
# Set voltages, if available for the device
0 commit comments