I don’t need to keep some servers running all the time, as Jellyfin, TVheadend or transmission.
I was turning these servers on and off by ssh, but now I want to centralize all in Home assistant.
So I created a shell command
transmission_off: 'sudo systemctl stop transmission-daemon'
And I call it from a script with a card on HA.
But it don’t work, I get error code 127, that seems to mean unknow command.
It’s a simple command, that works on ssh, so I think HA in a docker can’t access to the rest of raspbian system (I have HA running in a docker)
Have you experienced this problem? How can I turn these servers on and off from HA?.
This is by design. A docker container is sandboxed from the docker host. One way you could do this is to bind mount a folder inside your HA container then create a shell command to create/delete a file inside that folder. Create a script and add a cron job on the host that checks that folder every so often to see if the file exists. If it does turn on/do nothing if already running. If it doesn’t see the file turn off/do nothing if already not running.
I’m fairly new to HA so there may be some more sane method, but regardless you can’t run commands on the host from inside a container (Some exclusions apply, void where prohibited, no purchase necessary, etc.).