i want to play/pause my iTunes on my main-mac with OpenHAB.
in the terminal its already working without any password required
( i generated a key on both machines - “tutorial” can be found here )
its already working with this here:
ssh username@192.168.1.x 'osascript -e "tell application \"iTunes\" to playpause"'
is the account that openhab is running under the same as the one you installed the keys for? ie, the user account you are using to interactively run the ssh commands without prompts the same as what openhab is running under?
Your binding config was not formatted correctly. You were also missing a double quote at the end, and needed to escape some more of the quotes. When the escapes become a nightmare, you can just put the command into a shell script and call that from exec. Easier to test it too! See if this works:
Try turning up the logging for the exec binding and see what it is reporting for the response by entering this into the Karaf console (when you’re done, put it back by entering the same but replace DEBUG with WARN):
log:set DEBUG org.openhab.binding.exec
Maybe there’s something you can check on the other end?
Are you looking in the openhab.log? If you’re not seeing exec binding logs after toggling the switch, then the logging isn’t setup right. What does log:get show?
Another thing to try is to switch to the same user that is setup to run OH, and run the ssh command in the console. That would show you if the permissions were setup correctly.
2017-09-28 14:31:24.254 [ItemCommandEvent ] - Item 'iTunes2' received command ON
2017-09-28 14:31:24.256 [ItemStateChangedEvent ] - iTunes2 changed from OFF to ON