Hello again Home Assistant’s
I’m having a problem with a command_line sensor in that the command contains quotation marks around a web address and when the command is parsed by Home Assistant, the quotation marks are removed causing the command to fail.
I am running the latest version of Hassio and Home assistant and have successfully been able to run the command ( with quotation marks ) on the Hassio command line.
When the command is run on the Hassio command line without quotation marks, it fails.
I have a very similar command_line sensor, also with quotation marks around a web address, but when the address is parsed, the quotation marks are NOT removed.
I have tried every combination of single / double / no quotation marks I can think of, but they are always removed.
First the working sensor from sensors. yaml
# This one works and quotes remain after being parsed by HA
command: 'curl -k --silent "http://192.168.1.7:88/get_status.cgi?user=xxx&pwd=xxx" | grep alarm | cut -b 18'
and the corresponding entry in the .log file
2018-12-24 19:37:36 INFO (SyncWorker_7) [homeassistant.components.sensor.command_line] Running command: curl -k --silent "http://192.168.1.7:88/get_status.cgi?user=xxx&pwd=xxx" | grep alarm | cut -b 18
Note how in the above log entry the double quotes REMAIN around the web address.
Now the sensor that doesnt work from sensors.yaml
# This one doesn't work due to quotes being removed when parsed
command: 'curl -k --silent "https://pvoutput.org/service/r2/getstatistic.jsp?key=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx&sid=xxxxx&df={{(states.input_datetime.bill_date_from.attributes.year)}}{{(states.input_datetime.bill_date_from.attributes.month)}}{{(states.input_datetime.bill_date_from.attributes.day)}}&dt={{(states.input_datetime.bill_date_to.attributes.year)}}{{(states.input_datetime.bill_date_to.attributes.month)}}{{(states.input_datetime.bill_date_to.attributes.day)}}&crdr=1&c=1"'
and the corresponding entry in the .log file. The templating is parsed correctly.
2018-12-24 19:45:57 INFO (SyncWorker_7) [homeassistant.components.sensor.command_line] Running command: curl -k --silent https://pvoutput.org/service/r2/getstatistic.jsp?key=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx&sid=xxxxxx&df=20181121&dt=2019220&crdr=1&c=1
Note how in the above log entry the double quotes are REMOVED around the web address casuing the command to fail.
Can anyone suggest why the quotes are being removed, or better yet, suggest what I’m doing wrong here.
TIA