I’m not referring to using the ssh add-on. I’m talking about using ssh to connect to the host from inside the docker.
Ssh client not ssh server.
I’m not referring to using the ssh add-on. I’m talking about using ssh to connect to the host from inside the docker.
Ssh client not ssh server.
No idea. I’m merely discussing the OP’s setup.
Yeah but he’s running hass.io on Ubuntu… Reason I am asking is I don’t think it can be done the way you suggest… but if I’m wrong, I’d be interested to know how to do that.
So you’re saying it DOESN’T have an ssh client in the container?
EDIT: Looks like Home Assistant docker works as an SSH client just fine.
SSH from container to the host running the container:
If you create an SSH key and store it in the config directory, you can just call your key when you ssh to the host.
No it does but it does not contain a lot of the functionality of a normal shell… it’s way stripped down. So executing a script from a shell command, the shell commands in the script have to be supported by the shell provided by hass.io unless you can use a script to get through to a shell on the host and if you can do that I have not discovered how yet.
I am literally telling you HOW.
You run your shell command that you want THROUGH SSH…to the host.
Gotcha. I just looked closer. I will try that and see if that works.
The only thing I haven’t done here is configure a key to prevent the password prompt.
Once you configure the key, it’s a simple one liner calling a command on the other end of the SSH connection.
ok cool. I just did this from the HA container via a console in portainer and it gets through to the host. (which is all you need/want if you’re on a real linux distro and not HassOS anyway)
That may well work for the OP in that case.
Good info. Thanks.
Excellent, now the script Inside SSH is working but I still have an issue with the configuration.yaml
I have this:
shell_command:
quota_axel: /bin/bash /workspace/config/scripts/ssh_axel.sh
But I can’t see anything in the entities list and no logs.
Any idea ?
I don’t think you want the /workspace in there…
Just use a relative path
quota_axel: /bin/bash scripts/ssh_axel.sh
Although I was suggesting you run the SSH command right from that line.
Changed in the configuration.yaml.
The command line is working perfectly from the console but still no entry in the entities tab
Do I have to reboot or restart anything ? I’m currently always restarting the management server.
Thx
You have to restart Home Assistant when you modify configuration.yaml
No idea what this means.
That only reloads customizations. RESTART home assistant
I’ve tried !!
Do you have a working command shell ?
Here is the exact entry that I have in my yaml file.
shell_command:
quota_axel: /bin/bash scripts/ssh_axel.sh
How can I get more verbose in the log viewer ?
Yes.
What error do you get? Check the LOG FILE, not the half log in the GUI.
again, I was suggesting you:
A. create a ssh key for your container to your host (store it in /config)
B. use the SSH command directly as your command. I have no idea what your ssh_axel.sh contains to verify it is even remotely correct.
C. Restart home assistant