solis_control
solis_control copied to clipboard
Ensuring time[] attributes are strings before concatenating them
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