#Running bash script

1 messages · Page 1 of 1 (latest)

lament monolith
#

Hello,
I'm a big newbie when it comes to yaml. I've been trying to make my bash script work, but I can't get it to run. I'm using the HA supervised version on Raspberry pi 4B 64-bit.

My automations.yaml

- id: "1735718708324"
  alias: test3
  description: ""
  triggers:
    - trigger: state
      entity_id:
        - input_button.damn
  conditions: []
  actions:
    - action: shell_command.script_test
      data: {}
    - action: input_boolean.toggle
      metadata: {}
      data: {}
      target:
        entity_id: input_boolean.reset_homeassistant
  mode: single

My configuration.yaml

default_config:


frontend:
  themes: !include_dir_merge_named themes

automation: !include automations.yaml
script: !include scripts.yaml
scene: !include scenes.yaml
shell_command:
  script_test: /bin/bash /usr/share/hassio/homeassistant/shell/test.sh

I'd gladly appreciate any help!

lament monolith
#

This is the step detail of the shell command action:
Executed: January 1, 2025 at 4:08:33 PM Result: params: domain: shell_command service: my_host_script service_data: {} target: {} running_script: false

lament monolith
#

I tried this with a script and it doesn't work either: (scripts.yaml)

test1_2:
  alias: test1
  sequence:
    - service: shell_command.script_test
  description: ""

I get the following error when running the script:

Action shell_command.script_test uses action script.test1_2 which was not found.

prime blade
#

Are you certain it didn't work?
Try running the shell_command action in developer_tools/actions?

lament monolith
lament monolith
#

Also, I can't use the packages I have previously installed. That's another major issue

#

Is there any workaround or better way to run bash scripts with root file system access?

#

I've tried the SSH addon, but I apparently can't run anything outside the docker file system

lament monolith
#

@prime blade?

near sentinel
#

How have you tried the ssh addon if you are running HA Container? Add-ons are not supported with that installation method.

#

The more general answer to your question is that HA needs access to the folder(s) your bash scripts reside in and operate on. For HA container, that means adding those locations as volumes in docker, and then adding them to allowlist_external_dirs

lament monolith