Run bash script hosted on HASSIO via shell command - Error

Hi, im trying to get a shell command to run which is hosten on HASSIO with HASSIO.

I tried several different things that i found on this forum… none of them work.
The command itself works perfectly fine if i SSH into my HASSIO manually.
Does HASSIO use a different user than root on PI3?

set_alexa: ‘ssh -i /config/.ssh/id_rsa root@HASSIO /share/alexa_remote_control.sh -d Wohnzimmer -e vol:10’
set_alexa: ‘/share/alexa_remote_control.sh -d Wohnzimmer -e vol:10’
set_alexa: /share/alexa_remote_control.sh -d Wohnzimmer -e vol:10

The errors i get range from Code:1 to Code:255.

Do i really need to add the SSH command if i want to execute the shell script on the same machine?

I’m pretty sure that command will not work even if you had SSH. Hassio is limited with cli.

Do you mean from HASSIO itself?
When i manually SSH into my rpi and run this command it works fine :slight_smile:

If that’s the case, why are you trying to use ssh in your shell command? You are local to the CLI, you shouldn’t have to ssh into it.

Yes… i know… but it doesnt work… how can i do it without SSH into my CLI?

set_alexa: '/share/alexa_remote_control.sh -d Wohnzimmer -e vol:10’

would usually execute it directly, right?
Do you know if maybe hassio is using a different user than root?

I don’t remember honestly. It’s been a while since I snooped. I think you just need to cd into config/share, then call the file. You may want to search for shell_commands in the hassio area of the forum instead of configuration.

A quick google search turned up this thread which sounds familiar to what you are running into:

ok was able to narrow it down via adding the command
"2> /config/error.log"
to the end of the shell command.

As always…once you figure one thing out, several new problems come up…

It turns out that one of the required tool (jq - JSON Parser) cannot be found from the shell_command line.

However, it works perfectly fine when logging in to the terminal manually via putty… any idea why that would be?

is jq used by the sh file?

However, when you SSH to your Pi, that’s a different docker container than the one that runs HomeAssistant. That’s why you’re having these problems.

I was wondering if that was the case. Is that a different docker because the SSH component is an “ADD-ON” to hass.io?

Yes. Each add-on is a separate container. Items like /config are shared to those containers (I’m not sure what the entire list is, I don’t actually use Hass.io).

What’s your script? Are you using full paths for commands?

You can see the final working version here: Better Alexa Multiroom Volume Control & Alarm Scraping

Turns out running a script from within a very simple script works pretty good as opposed to be running the script just by itself…