I was also thinking about this some more, and came up with a less elegant method which doesn’t require SSH.
-
Turn on your Mac’s internal web server (loads of instructions on Google, I use MAMP for work so I used that).
-
I use the same shell script to launch a Mac app (or an applescript to press ‘enter’ in OP’s case). This script is named ‘launchapp.sh’
#!/bin/sh
export DYLD_LIBRARY_PATH=""
osascript -e 'tell application "NewBlockParty" to activate'
Save it somewhere, I just put in a folder named mac-scripts in MAMP’s htdocs folder.
- Put a tiny PHP script named launchapp.php in the MAMP htdocs folder:
<?php
$start_app = exec('/Applications/MAMP/htdocs/mac-scripts/launchapp.sh');
You may need to give this script permissions (chmod 755).
- Now you can use a command line switch in HA to launch your script:
- platform: command_line
switches:
new_block_party_playlist:
friendly_name: New Block Party
command_on: "curl -sS http://192.168.0.3:8888/mac-scripts/launchapp.php"