Folks, having initially set up a working automation to upload my Fronius inverter data to HA, comprising energy generation, energy consumption, temperature and mains voltage, I soon realised that I was using the wrong sensor data. Having now fixed that up in my Configuration.yaml file the upload has stopped working.
I am fairly confident that this has something to do with the formatting of the uploaded values to PVOutput, potentially resulting from the (mis)use of the float and round functions.
Am hoping that someone could kindly review the enclosed payload description and tell me where I may be going wrong.
Here is the current payload setting that does not get uploaded.
payload: “d={{now().strftime(‘%Y%m%d’)}}&t={{now().strftime(‘%H:%M’)}}&v1={{(states(‘sensor.fronius_smart_meter_real_energy_produced’))|float(0)}}&v3={{(states(‘sensor.fronius_smart_meter_real_energy_consumed’))|float(0)}}&v5={{(states(‘sensor.openweathermap_temperature’))|round(1)}}&v6={{(states(‘sensor.myenergi_car_charger_voltage_grid’))|float(0)}}”
The HA Log shows the following error message when this automation runs;
2024-12-03 12:34:16.430 INFO (MainThread) [homeassistant.components.automation.upload_to_pvoutput_rest_command] PVOutput Uploader (rest_command): Running automation actions
2024-12-03 12:34:16.431 INFO (MainThread) [homeassistant.components.automation.upload_to_pvoutput_rest_command] PVOutput Uploader (rest_command): Executing step call service
2024-12-03 12:34:17.250 WARNING (MainThread) [homeassistant.components.rest_command] Error. Url: https://pvoutput.org/service/r2/addstatus.jsp. Status code 400. Payload: b’d=20241203&t=12:34&v1=1015245.0&v3=1176226.0&v5=27.7&v6=240.5’
A “400” error code on PVOutput signifies a “Bad Request” which means the server could not process your request due to an issue with the information you provided, likely an error in the data format or missing required details when trying to send data to your PVOutput account; essentially, it’s a problem with the request you sent, not the server itself
I am 100% confident that my PVOutput user ID and API key are good as the previous script went through using these same variables. The only changes have been to the sensors and the inclusion of the round & float commands.