Hi,
I have the following code
sensor:
- platform: command_line
command: /home/hass/.homeassistant/RMTasker/rmtemp.sh
name: TV Room Temp
unit_of_measurement: "°C"
- platform: command_line
command: /home/hass/.homeassistant/RMTasker/living.sh
name: Living Room Temp
unit_of_measurement: "°C"
The first command_line works perfectly, the second it gives me error (but the two files rmtemp.sh and living.sh are essentially the same).
Is the problem the multiple - platform:command_line?
fabaff:
What’s the error?
16-12-05 12:44:02 homeassistant.components.sensor.command_line: Command failed: /home/hass/.homeassistant/RMTasker/living.sh
This is living.sh
rmout=$(curl -s http://192.168.1.50:9876/temperature?deviceMac=MAC_ADDRESS1)
echo "$rmout" | grep -o -P '(?<="temperature":).*(?=,"timestamp")'
Maybe living.sh
doesn’t have executable flag.
You may try to pass your commands in HA config, like this:
sensor:
- platform: command_line
command: "curl -s http://192.168.1.50:9876/temperature?deviceMac=MAC_ADDRESS1 | grep -o -P '(?<="temperature":).*(?=,"timestamp")'"
name: TV Room Temp
unit_of_measurement: "°C"
First link in google says:
command-line, executable
@omeasire
I get this in error log
16-12-05 18:22:06 homeassistant.util.yaml: while parsing a block mapping
in “/home/hass/.homeassistant/configuration.yaml”, line 275, column 5
expected , but found ‘’
in “/home/hass/.homeassistant/configuration.yaml”, line 276, column 107
but I don’t think the other is executable (rmtemp.sh)
Okay, try to execute /home/hass/.homeassistant/RMTasker/living.sh
in your shell and post result here.
pi@raspberrypi:~ $ /home/hass/.homeassistant/RMTasker/rmtemp.sh
21.7
pi@raspberrypi:~ $ /home/hass/.homeassistant/RMTasker/living.sh
-bash: /home/hass/.homeassistant/RMTasker/living.sh: /bin/bash^M: bad interpreter: No such file or directory
This is the reason.
Post the contents of rmtemp.sh and living.sh
Yeap, I created the file in windows environment and somehow some strange character went in. Now it works.
Thanks