based @koying solution .
Im running HA on docker (QNAP) .
I copy the remote_command_line custom_components/
I added below:
remote_command_line:
fetch_ha_image:
ssh_user: user
command_timeout: 900
command: >
IMAGE=`docker inspect home-assistant | jq -r '.[0].Config.Image'`; docker pull -q ${IMAGE}
When execute I got
2022-11-03 09:44:47.129 ERROR (SyncWorker_6) [custom_components.remote_command_line] Command failed: ssh -4 -o ConnectTimeout=3 -o StrictHostKeyChecking=no -i /config/.ssh/id_rsa [email protected] 'IMAGE=`docker inspect home-assistant | jq -r ''.[0].Config.Image''`; docker pull -q ${IMAGE}'
I created ssh key between ha–> qnap
and place it in /share/mynap/HA/ssh/id_rsa
I did verify i’m able to execute script from the HA using:
my_test: ssh -i /share/mynap/HA/ssh/id_rsa -o UserKnownHostsFile=/dev/null -o 'StrictHostKeyChecking=no' myuser@NAS '. /share/myqnap/HA/MyScripts/test.sh'
So I edit the custom_components/remote_command_line /init
and place the parameter with hardcoded value in
ssh_command = f"ssh -4 -o ConnectTimeout=3 -o StrictHostKeyChecking=no /share/mynap/HA/ssh/id_rsa myuser@NAS '{escaped_command}'"
and it still through errors:
2022-11-03 10:14:01.563 ERROR (SyncWorker_3) [custom_components.remote_command_line] Command failed: ssh -4 -o ConnectTimeout=3 -o StrictHostKeyChecking=no /share/Avi/HA/ssh/id_rsa myuser@NAS 'IMAGE=`docker inspect home-assistant | jq -r ''.[0].Config.Image''`; docker pull -q ${IMAGE}'