HAOS container file systems access

We have Home Assistant Operating System (HAOS) installed on a Raspberry Pi and it all works great: 45 devices, 51 automations, 12 blueprints, etc, started about 18 months ago.

EXCEPT automations calling bash scripts… The scripts work fine via
Settings->Automations->[automation]->Run.

Also scripts work fine when run on the Terminal plug-in command line.

BUT the same scripts called by “When time” triggers automation encounters “file not found /usr/bin/rsync” or “aplay: device_list:277: no soundcards found”.

I understand that HAOS runs a containerized HA, but I am mystified that the interactive interface is so different from the automated interface. Surely I am missing an important detail and [troll bait warning] someone can show me the difference so that I can get our scripts working.

Any nudge would be greatly appreciated!

You need to put the script somewhere that is accessible to the homeassistant container - for example in the “/config” folder.

Thank you, but the script location is not the problem. In both my examples the scripts are /share/mybin/{backup2share,playtester} and HA is able to invoke them via “when”. The invocation is able to write trace files such as /share/backups/last.txt and /share/tmp/playtester.out

PS, all the same file system in this vanilla deployment:
/config df -m /config /share
Filesystem 1M-blocks Used Available Use% Mounted on
/dev/mmcblk0p8 119594 9459 105237 8% /addon_configs
/dev/mmcblk0p8 119594 9459 105237 8% /addon_configs

The Terminal addon one is an addon like any other, i.e. a docker container that basically has nothing in common with HAOS itself besides a couple of shared folders.

You cannot make any assumptions based on the fact that a script will work in the addon.

The only way to properly test your scripts is to ssh to HAOS itself, via:

koying,

Thank you… I see that I did not realize the differences between addons and HAOS, now I comprehend:

  • Terminal contains /usr/bin/rsync, but HAOS does not.
  • Both can access /config, /share, and several others; these appear as mounted filesystems when running “mount” in the Terminal
  • The /usr/bin/rsync file resides on filesystem “overlay” of the Terminal addon.

The info you provided contains a dreaded Dragons Be Here warning:

This section is not for end users… This is for developers of Home Assistant.

So, to do this right, I need to assemble another Raspberry Pi for development.

But first–probably not the right way even it works–can I invoke Terminal from HAOS inside an automation? I’m presuming such an invocation could pass along an parameter of what to do.

Your sage advice is greatly appreciated,

-Kevo

Following up…

Can I invoke Terminal from HAOS inside an automation? I’m presuming such an invocation could pass along an parameter of what to do.

Any advice is greatly appreciated,