Hi everybody,
I’m trying to check for the existence of a file in the HA config folder and have defined a binary sensor to this end. Unfortunately the sensor remains unknown and I can’t figure out where I’m going wrong…
My HA installation runs on a RPi in a docker environment.
The binary sensor definition looks like this:
command_line:
- binary_sensor:
name: "File Existence"
command: test -e /config/test.txt && echo 'off' || echo 'on'
scan_interval: 5 # Set the interval in seconds to check the file existence
Troubleshooting so far:
- tested the command inside the docker container bash. Command returns on or off, depending on whether file exists or not. File is in correct folder.
- updated state manually from developer tools / states. After a few seconds the sensor updates back to “unknown”, so probably updates are being executed
- checked home assistant log. No errors relating to the sensor to be seen.
Any help or ideas are greatly appreciated!