Thanks for your reply,
I had already looked there, but after you reply I looked more closely and realised the problem was actually the lack of single quotes around the variables, inserting two single quotes around the variable function solved the problem.
However I now have another problem, the following sensor is sending data without being ( as far as I can tell) triggered.
- platform: command_line
name: upload
command: "curl -d d=''{{ states('sensor.time_formatted' ) }}'' -d t=''{{ states('sensor.time' ) }}'' -d v4=''{{ states('sensor.value' ) }}'' -d v2='676' -H 'key: 1f1930efacf7c1bababababab9dbbca3f97493d5' -H 'SystemId:12345' http://web.address/status.jsp"
I have tried doing this with the command line switch instead
switch:
- platform: command_line
switches:
output_upload:
command_on: "curl -d d=''{{ states('sensor.time_formatted' ) }}'' -d t=''{{ states('sensor.time' ) }}'' -d v4=''{{ states('sensor.value' ) }}'' -d v2='676' -H 'key: 1f1930efacf7c1bababababab9dbbca3f97493d5' -H 'SystemId:12345' http://web.address/status.jsp"
value_template: '{{ value == "1" }}'
But I get the following error
2021-06-22 13:50:02 ERROR (SyncWorker_2) [homeassistant.components.command_line] Command failed: curl -d d=’’{{ states(‘sensor.time_formatted’ ) }}’’ -d t=’’{{ states(‘sensor.time’ ) }}’’ -d v4=’’{{ states(‘sensor.value’ ) }}’’ -d v2=‘676’ -H ‘key: 1f1930efacf7c1bababababab9dbbca3f97493d5’ -H ‘SystemId:12345’ http://web.address/status.jsp"
2021-06-22 13:50:02 ERROR (SyncWorker_2) [homeassistant.components.command_line.switch] Command failed: curl -d d=’’{{ states(‘sensor.time_formatted’ ) }}’’ -d t=’’{{ states(‘sensor.time’ ) }}’’ -d v4=’’{{ states(‘sensor.value’ ) }}’’ -d v2=‘676’ -H ‘key: 1f1930efacf7c1bababababab9dbbca3f97493d5’ -H ‘SystemId:12345’ http://web.address/status.jsp"
It is exactly the same curl command in both examples, I am totally confused!