Hi there,
Im Running Hass.io on HassOs on my raspberry pi.
Unfortunately I have the problem that I can’t run an ssh command from HA (using ssh adding and running it there works fine).
For ssh I’m using an certificate without password.
Already tried running it from within an python file, which results in this error:
2019-07-23 13:27:15 ERROR (SyncWorker_3) [homeassistant.components.python_script.roborock_floor1_mop.py] Error executing script: __import__ not found
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/python_script/__init__.py", line 159, in execute
exec(compiled.code, restricted_globals, local)
File "roborock_floor1_mop.py", line 1, in <module>
ImportError: __import__ not found
Running it as a shell_command inserting the ssh command directly there isn’t working, too.
Hassio (Home Assistant) is running in its own container. That is where you problem lies. Not the SSH add-on (which is a completely different container), and not the host OS (HassOS). HassOS isn’t making the SSH call, your hassio container is.
Absolutely no chance to get this working in the UI (in the File Editor it works).
Not with hassio.addon_stdin, not with the shell_command not in an automation or in Node-RED. Nothing. Put it in a shell file, chmod +x and it runs wonderfully in terminal. Granted all access for testing: Nothing. Not with core_ssh or with the ssh addon.
May anybody help me out here? I am running mad at the moment
DUDE! You just resolved my 48 hour nightmare. THANK YOU.
I’ll add my own shipwreck here as a lighthouse to others. You can’t put this in a Bash script and call it with shell_command - I couldn’t get that to work. Without the ability to log in to Hassio outside the Docker container, I could not find a way to path ANY .sh file such that it worked. Here’s my working snippet from configuration.yam:
I copied my id_rsa and id_rsa.pub keys from /data/.ssh to /config/.ssh
So wish Hassio would allow us to SSH into the pi itself instead of the docker container. I know that opens up a can of risk but damn this shouldn’t have been so hard.