maybe one of you guys can help me
so shortly my setup, im running HA as a VM and have a physical iMAC next to it.
i have installed the Terminal Add-on.
created ssh keys and exchanged them with my mac. so far so good
on my Mac i have a script called SendMessage.sh which well⌠sends the message
#!/bin/sh
recipient="${1}"
message="${*:2}"
cat<<EOF | osascript - â${recipient}â â${message}â
on run {targetBuddyPhone, targetMessage}
tell application âMessagesâ
set targetService to 1st service whose service type = iMessage
set targetBuddy to buddy targetBuddyPhone of targetService
send targetMessage to targetBuddy
end tell
end run
EOF
when i run in terminal:
ssh -o âStrictHostKeyChecking=noâ [email protected] â/Users/your_username/Documents/SendMessage.sh [email protected] âTest from Home Assistantââ
i get a notification on my phone, so basically works as expected.
so now i wanted to use it in an notification and basically use âTargetâ and âMessageâ Values to be a little more flexible.
so on my HA i created the script âimessage.shâ, made it executeble with following content:
#!bash
ssh -o âStrictHostKeyChecking=noâ [email protected] â/Users/your_username/Documents/SendMessage.sh $1 â$2ââ
i then created a shell command:
shell_command:
imessage: >
bash /config/scripts/imessage.sh {{ target }} â{{ message }}â
i created a long lived access token and stored it in my !secret as
imessage_rest: âBearer XXXXXXXXXXXXXXXXXXXXXâ
Hi! thanks for all the informations this is very nice! What do you mean by once run the script within HA? everything works very well when I run the shell command from the terminal addon, but when I try from the developper tool, i got this error:
stdout: ââ
stderr: âWarning: Identity file /config/.ssh/id_rsa not accessible: No such file or directory.\nPermission denied, please try again.\r\nPermission denied, please try again.\r\nReceived disconnect from 192.168.68.67 port 22:2: Too many authentication failures\r\nDisconnected from 192.168.68.67 port 22â
returncode: 255