Running Script through SSH works with Terminal & SSH Add-on but not when run as a Service

Tags: #<Tag:0x00007f3264d5e0b0> #<Tag:0x00007f3264d5de80> #<Tag:0x00007f3264d5dd40> #<Tag:0x00007f3264d5d980>

I want to run an AppleScript on my Macbook from HA as part of an Automation.

I’ve set up ssh keys and running the command through the Terminal & SSH Add-on works without entering a password.

ssh -i /root/config/ssh/id_rsa -o 'StrictHostKeyChecking=no' [email protected] osascript /Users/maxerdmann/Documents/Wake.scpt

I’ve set up the same command as a shell service in the configuration.jaml:

shell_command:
  wake: ssh -i /root/config/ssh/id_rsa -o 'StrictHostKeyChecking=no' [email protected] osascript /Users/maxerdmann/Documents/Wake.scpt

Trying to run in through developer tools returns the following error:

Error running command: `ssh -i /root/config/ssh/id_rsa -o 'StrictHostKeyChecking=no' [email protected] osascript /Users/maxerdmann/Documents/Wake.scpt`, return code: 255
NoneType: None

Any pointers as to what im doing wrong would be appreciated.

update:
got it to work using

ssh -F /etc/ssh/ssh_config -i /config/ssh/id_rsa [email protected] 'osascript /Users/maxerdmann/Documents/Wake.scpt' 2> /config/command.log

thanks to this post: Error when executing SSH command using command line switch