@@ -1368,28 +1368,28 @@ def get_battery_data(self, batIndex=None, dcbs=None, keepAlive=False):
13681368 voltages = []
13691369
13701370 # Set temperatures, if available for the device
1371- temps = rscpFindTag (req , RscpTag .BAT_DCB_ALL_CELL_TEMPERATURES )
1372- if temps is not None and len ( temps ) == 3 and temps [ 1 ] != "Error" :
1373- temperatures_raw = rscpFindTagIndex (
1374- rscpFindTag ( req , RscpTag . BAT_DCB_ALL_CELL_TEMPERATURES ),
1375- RscpTag . BAT_DATA ,
1376- )
1377- temperatures = []
1371+ temperatures_raw = rscpFindTag (req , RscpTag .BAT_DCB_ALL_CELL_TEMPERATURES )
1372+ if (
1373+ temperatures_raw is not None
1374+ and len ( temperatures_raw ) == 3
1375+ and temperatures_raw [ 1 ] != "Error"
1376+ ):
1377+ temperatures_data = rscpFindTagIndex ( temperatures_raw , RscpTag . BAT_DATA )
13781378 sensorCount = rscpFindTagIndex (info , RscpTag .BAT_DCB_NR_SENSOR )
13791379 for sensor in range (0 , sensorCount ):
1380- temperatures .append (temperatures_raw [sensor ][2 ])
1380+ temperatures .append (temperatures_data [sensor ][2 ])
13811381
13821382 # Set voltages, if available for the device
1383- voltages = rscpFindTag (req , RscpTag .BAT_DCB_ALL_CELL_VOLTAGES )
1384- if voltages is not None and len ( voltages ) == 3 and voltages [ 1 ] != "Error" :
1385- voltages_raw = rscpFindTagIndex (
1386- rscpFindTag ( req , RscpTag . BAT_DCB_ALL_CELL_VOLTAGES ),
1387- RscpTag . BAT_DATA ,
1388- )
1389- voltages = []
1383+ voltages_raw = rscpFindTag (req , RscpTag .BAT_DCB_ALL_CELL_VOLTAGES )
1384+ if (
1385+ voltages_raw is not None
1386+ and len ( voltages_raw ) == 3
1387+ and voltages_raw [ 1 ] != "Error"
1388+ ):
1389+ voltages_data = rscpFindTagIndex ( voltages_raw , RscpTag . BAT_DATA )
13901390 seriesCellCount = rscpFindTagIndex (info , RscpTag .BAT_DCB_NR_SERIES_CELL )
13911391 for cell in range (0 , seriesCellCount ):
1392- voltages .append (voltages_raw [cell ][2 ])
1392+ voltages .append (voltages_data [cell ][2 ])
13931393
13941394 dcbobj = {
13951395 "current" : rscpFindTagIndex (info , RscpTag .BAT_DCB_CURRENT ),
0 commit comments