File sensors, why so hard

I have what I thought was a simple task of adding a file sensor. My config is basic with everything in the configuration.yaml

  - platform: file
    name: 'PoolTemp'
    file_path: config/test/temperature.txt

      supported_features: 161
    - config/test

Check configuration comes back with “Configuration valid”

I’ve reloaded location & Customizations as the site says. I’ve also restarted the home assistant server, multiple times. I can’t find the sensor anywhere. I’ve tried multiple locations and no matter what I do, I don’t think this works. The documentation makes it look easy, but I see many have the same stumbling blocks with no real consistent fixes.

I take it I’m overlooking something simple?



Try /config/test instead. Saying config/test when that file is in /config is actually saying /config/config/test.

1 Like

Thanks Tedior,

Adding the “/” within

    - /config/test/

Produces this error on the config check
not a directory @ data['whitelist_external_dirs'][0]

The full path of the test directory is:

Ah ok, so the full path is indeed /config/config/test. Change it back to what you had before, restart home assistant, and look for the sensor at developer tools > states. It should be named sensor.pooltemp.

Portainer reveals the volume mapping for the HomeAssistant container:

Host/volume Path in container
/usr/share/hassio/audio/asound /etc/asound.conf
/usr/share/hassio/homeassistant /config
/usr/share/hassio/ssl /ssl
/usr/share/hassio/share /share
/usr/share/hassio/tmp/homeassistant_pulse /etc/pulse/client.conf
/usr/share/hassio/audio/external /run/audio
1 Like


No, like I said the full path is /usr/share/hassio/homeassistant/config/test, so no on the /config/config/test.

However I just noticed the log without having the leading /

    - config/test

Does not give me a config check error, but I am seeing this in the logs:
config/test/temperature.txt’ is not a whitelisted directory

I seem to be going around in circles with this…

I didn’t see Tara’s reply until after I replied to Tediore’s response. Tara hit the nail on the head. I was unknowing of this mapping so in my feeble mind, the root directory was homeassistant directory with /config being homeassistant/config. This makes sense now and my sensor is working.

Working config for me is:

    - /config
  - platform: file
    name: 'PoolTemp'
    file_path: /config/temperature.txt

Tediore, I see now what you were getting at with the double config dir… Thanks!