Accessing folders in Ubuntu with Home Assistant through Docker...? Can it be done?

I have a few file sensors (-platform: folder) setup in HASS.io which is running under Docker on Ubuntu 16.04. Those folders are located in the /config folder for HA and they provide a file-count of audio files for random sound automations.

Since the /config folder is simply the /usr/share/hassio/homeassistant folder in Ubuntu, is it possible for HASS.io to read other system folders for folder sensors that are outside of the homeassistant folder?

For example:

/home/<user>/domains/subdomain.domain.com/public_html

-or-

/home/<user>/<whatever>/

If so, what would the path be in the following example, for /home/<user>/Documents/?

- platform: folder
  folder: ???

Docker is isolating hass.io from the rest of your Ubuntu system. That’s its reason for existence. The Docker command to run hass.io maps host volumes to container volumes. This is what it’s doing to map /usr/share/hassio/homeassistant to /config.

Ordinarily, you would modify the way Docker is running the container to give it visibility to other folders. However, you don’t have this control over hass.io. But hass.io provides an alternative (that I have not used). In configuration.yaml you can use whitelist_external_dirs to provide access to folders external to hass.io. So your config would look something like this:

homeassistant:
  whitelist_external_dirs:
  - /home/<user>/<whatever>

And then you should be able to reference those folders in your sensor.

1 Like