Shell commands not executing

Hi everyone, currently I’m baffled by this issue. I can’t seem to figure out why some of my shell commands are not executed. They worked fine in the past but due to a corrupted flash drive I had to reinstall a clean image on my pi.
HASS runs in a virtualenv and when I switch to the HASS user and activate the virtualenv ALL shell commands run just fine from the command line.

2017-09-01 11:35:44 ERROR (Thread-2) [homeassistant.components.sensor.command_line] Command failed: cat /sys/class/thermal/thermal_zone0/temp
2017-09-01 11:35:44 ERROR (Thread-12) [homeassistant.components.sensor.command_line] Command failed: curl -k --silent "http://10.0.1.30:88/cgi-bin/CGIProxy.fcgi?cmd=getDevState&usr=XXX&pwd=XXX" | grep -oP "(?<=motionDetectAlarm>).*?(?=</motionDetectAlarm>)"

- platform: command_line
  command: 'curl -k --silent "http://10.0.1.30:88/cgi-bin/CGIProxy.fcgi?cmd=getDevState&usr=XXX&pwd=XXX" | grep -oP "(?<=motionDetectAlarm>).*?(?=</motionDetectAlarm>)"'
  name: camera oprit motion sensor
  value_template: >-
    {%- if value == "0" -%}
      Disabled
    {%- elif value == "1" -%}
      Idle
    {%- elif value == "2" -%}
      Alert
    {%- endif -%}
  scan_interval: 5

This shell command (show current HASS version) works just fine:

- platform: command_line
  name: Installed version
  command: "/srv/homeassistant/bin/hass --version"

Thanks for helping me out in advance.
// Harmen

Never mind, I finally got it working again. I fixed it by adding correct paths to ENVIRONMENT in /etc/systemd/system/[email protected].

Environment=PATH="$VIRTUAL_ENV/bin:/usr/sbin:/usr/local/sbin:/usr/local/bin:/usr/bin:/sbin:/bin:$PATH"

2 Likes