Configuration issue - sensor command line not working

Hello all,

I’m a new guy to the Home Automation world, and with my second foray I’ve got an issue with sensor command line not running as expected. I’m running a hassio docker instance patched to current, and is running on a CentOS instance on an old NUC.

The basics have been working as expect, and I have integrated my garage doors so far - many more device to come. The problem comes when I try to run some command line calls. I have weather data being collected in a file inside the homeassistant directory called “weather.data”. I copied a sensor config from another poster, and both the command lines return values when I run it within the hassio shell, but doesn’t appear to be working as a sensor call (config and log entries below). Both sensor calls aren’t working as I believe they should.

It’s something basic I’m sure. I’ve searched the forums, the interwebs, and now I am coming to you all. Any ideas what I’m missing? Your help is appreciated.

from configuration.yaml

sensor:
  - platform: command_line
    name: Outdoor Temperature
    command: 'grep "933" /usr/share/hassio/homeassistant/weather.data  |tail -n1'
    json_attributes:
      - temperature_C
    value_template: '{{ value_json.temperature_C }}'
  - platform: command_line
    name: badlogin
    command: "grep -c 'Login attempt' /usr/share/hassio/homeassistant/home-assistant.log"

From my log file:

2019-11-06 09:37:46 DEBUG (SyncWorker_11) [homeassistant.components.command_line.sensor] Running command: grep -c 'Login attempt' /usr/share/hassio/homeassistant/home-assistant.log
2019-11-06 09:37:46 ERROR (SyncWorker_11) [homeassistant.components.command_line.sensor] Command failed: grep -c 'Login attempt' /usr/share/hassio/homeassistant/home-assistant.log
2019-11-06 09:37:46 DEBUG (SyncWorker_8) [homeassistant.components.command_line.sensor] Running command: grep "933" /usr/share/hassio/homeassistant/weather.data  |tail -n1
2019-11-06 09:37:46 WARNING (SyncWorker_8) [homeassistant.components.command_line.sensor] Empty reply found when expecting JSON data

Well that was silly, but I least I found the answer on my own. The problem was the file path - when I removed the “/usr/share/hassio/homeassistant” both calls work.

Out of curiosity, within hassio configuration.yaml what is the path from top level to get to files within the install? “/config”?

Good question :thinking: . Anyone?