As a little update here, Better Touch Tool wasn’t working when the screen locked (even with the server set to never sleep) so I went back to the drawing board and figured out how to send keystrokes to Airfoil to select speaker groups, change volume and mute. Very easy once one learns a little bit of AppleScript.
Stereo pairs now working too
#!/bin/bash
osascript <<EOD
tell application "Airfoil" to activate
tell application "Airfoil"
disconnect from (every speaker)
end tell
delay 1
tell application "System Events"
tell application "System Events" to keystroke "2" using command down
end tell
delay 2
tell application "Airfoil"
set (volume of every speaker) to 0.5
end tell
EOD
#!/bin/bash
osascript <<EOD
tell application "Airfoil" to activate
tell application "System Events"
key code 125 using {shift down, command down}
end tell
EOD
Yet another update- the above was NOT working with the screen locked, so I’ve come full circle and am back to something similar to my original example which for whatever reason DOES work with the screen locked. It also skips the step of disconnecting from everything before only connecting to the desired outputs.
#!/usr/bin/osascript
tell application "Airfoil"
launch
activate
get every speaker
disconnect from (every speaker whose id contains "Left")
disconnect from (every speaker whose id contains "Right")
disconnect from (every speaker whose id contains "Ecob")
connect to (every speaker whose id contains "Bath")
end tell
-- make sure volume not muted
set vol to output volume of (get volume settings)
if vol < 20 then
set volume output volume 50
end if
delay 1
Just came across this, this is pretty sweet. How are you targeting different HomePods? Just sshing and running the tts script with the text parameter seems like it would only target everything airfoil is connected to.
This is REAL cool and the solution to my home security system EXCEPT as of Montery the shell command for speaker no longer works… The suggest path "/users/username/.homeassistant/… no long appears valid as Ap[ple continues its user friendly practices
Well if you’re running Catalina or Ventura and you’re not running in docker or something (in which case I have no idea) then it’s about what user starts home assistant. If you have a user specifically for HA then it’ll be in that user’s main folder. If all else fails… sudo find / -type d -name '.homeassistant'
This must have something to do with the structure of the files in the VM- do you have to search those separately? I use a VENV but not a hypervisor so I don’t know how that works.
Now you are talking way above me… As fa as I can figure out VENV create a virtual enviroment using python Reviewing https://www.home-assistant.io/installation/macos. it would appear that ti create t virtual “somethings” oner fo HA OS and other for the Core