solis_control icon indicating copy to clipboard operation
solis_control copied to clipboard

Ensuring time[] attributes are strings before concatenating them

Open CraigCallender opened this issue 1 year ago • 0 comments

I was running into issues when trying to set the various values as the value they were coming in from weren't strings (jinja templating horror). I figured it was a good idea to ensure they're strings in Python as the failure I was getting was a python error that you can't concatenate an int/float type.

Error:

Exception in <file.solis_control.solis_control> line 59: body = body +time['chargeCurrent']+","+time['dischargeCurrent']+","+time['chargeStartTime']+","+time['chargeEndTime']+","+time['dischargeStartTime']+","+time['dischargeEndTime'] ^ TypeError: can only concatenate str (not "int") to str
Exception in <file.solis_control.solis_control> line 59: body = body +str(time['chargeCurrent'])+","+time['dischargeCurrent']+","+time['chargeStartTime']+","+time['chargeEndTime']+","+time['dischargeStartTime']+","+time['dischargeEndTime'] ^ TypeError: can only concatenate str (not "float") to str

CraigCallender avatar Jun 28 '24 12:06 CraigCallender