Hi all,
hope anyone can help me. I’m struggling with the syntax of my shell command to run a day-ahead optimization:
Running the shell command gives a 400 Bad request, although the syntax seems correct:
trigger_entsoe_da: “curl -i -H \“Content-Type: application/json\” -X POST -d ‘{\“load_cost_forecast\”:{{(states(‘sensor.electricity_price_offtake_next24h_1’)+states(‘sensor.electricity_price_offtake_next24h_2’))}},\“prod_price_forecast\”:{{(states(‘sensor.electricity_price_offtake_next24h_1’)+states(‘sensor.electricity_price_offtake_next24h_2’))}},\“pv_power_forecast\”:{{states(‘sensor.solcast_24hrs_forecast’)}}}’ http://localhost:5000/action/dayahead-optim”
I escaped the double quotes.
If I enter the above syntax in HA developer tools template, it resolves correctly:
But still the shell command returns following error:
stdout: “HTTP/1.1 400 BAD REQUEST\r\nContent-Length: 167\r\nContent-Type: text/html; charset=utf-8\r\nDate: Wed, 13 Dec 2023 17:45:45 GMT\r\nServer: waitress\r\n\r\n<!doctype html>\n\n400 Bad Request\n
Bad Request
\nThe browser (or proxy) sent a request that this server could not understand.
”
stderr: “% Total % Received % Xferd Average Speed Time Time Time Current\n Dload Upload Total Spent Left Speed\n\r 0 0 0 0 0 0 0 0 --:–:-- --:–:-- --:–:-- 0\r100 1035 100 167 100 868 39155 198k --:–:-- --:–:-- --:–:-- 252k”
returncode: 0