Make Airplay speakers the voice of HA & other fun MacOS tricks

Ok I just can’t seem to find the hidden .homeassisstant. in my home directory or any where else unless I do a link via Samba

Mike- open Script_editor.app and put this code in, then run it. It will list your HomePods for you and you can pick a keyword from each of them:

tell application "Airfoil"
	launch
	activate
	get every speaker
end tell

Then you can use they keyword like I do in the examples above:

	connect to (every speaker whose id contains "Bath")

Stereo pairs appear to be only listed once so Airfoil sees them as a single speaker.

Jason you can hide & unhide hidden files (start with a dot) in Finder using this keyboard combo:
shift-command-period

This is still working for me. Make sure you replace “username” with the actual HA user’s name…

I understand about hidden files and finder.but .homeassistant isn’t there

-r--------    1 jason  staff       7 Nov  1  2021 .CFUserTextEncoding
-rw-r--r--@   1 jason  staff   24580 Jan 13 04:41 .DS_Store
drwx------    3 jason  staff      96 Mar 30 04:35 .Trash
-rw-------    1 jason  staff    9167 Oct 29 14:07 .bash_history
drwx------   33 jason  staff    1056 Oct 26 13:52 .bash_sessions
-rw-r--r--    1 jason  staff      23 Apr 22  2022 .bashrc
drwx------    3 jason  staff      96 Nov  2  2021 .cups
drwxr-xr-x   16 jason  staff     512 Mar 30 05:32 .dropbox
drwxr-xr-x    9 jason  staff     288 Jan 12 13:50 .dynupdater
-rw-------    1 jason  staff    1843 Jan 15 08:41 .history
drwxr-xr-x    4 jason  staff     128 Sep 18  2022 .local
-rw-r--r--    1 jason  staff     257 Apr 22  2022 .profile
drwxr-xr-x    6 jason  staff     192 Sep 18  2022 .pyenv
drwx------    4 jason  staff     128 Jan 12 12:47 .ssh
-rw-r--r--    1 jason  staff    1401 Oct 26 12:27 .tcshrc
drwx------    6 jason  staff     192 Nov  8  2021 .vnc
-rw-r--r--    1 jason  staff     130 Dec  3  2021 .vuescanrc
-rw-r--r--    1 jason  staff      33 Apr 22  2022 .zprofile

I have no problem running the applcript form te Mac I just can’t see how to run from homeassistant

You’re probably starting HA as root, in which case look for your config files here:
/private/var/root/

I talk about this confusion in the fourth or fifth paragraph here.

I will read your link wenI have a clear head. as the configuration files are not in my

/private/var/root/

what. have there is

drwxr-x---   5 root  wheel   160 Nov  1  2021 .
drwxr-xr-x  34 root  wheel  1088 Mar 31 10:09 ..
-rw-r--r--   1 root  wheel     3 Nov  1  2021 .CFUserTextEncoding
-r--r--r--   1 root  wheel    10 Aug 17  2018 .forward
drwx------  21 root  wheel   672 Oct 29 15:10 Library
sh-3.2# 

and they dot appear in the Library

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'

I am Monterey and Home Assistant as follow

Home Assistant 2023.1.7
Supervisor 2023.01.1
Operating System 9.5
Frontend 20230110.0 - latest

I’m Virtual Machine running Under Virtual Box. I have no idea what docker is. That may be my core problem

Ok did some research seems docker is a hole different approach but it better access to MacOS
statement?

I don’t use it- seems like unnecessary complexity to me

Your

sudo find / -type d -name ‘.homeassistant’

finds nothing and give some a series operations to permitted even though my sudo password is accepted

I am running HA under my user ID. and .homeasistant doe not appear in my home directory . re you running it under a virtual machine?

Hmm you’ve lost your config files.

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

Ohhh you’re using the HA OS version (which I’ve never used). A quick search yields:
/root/config/

You’ll have to look inside the container though, however you do that

I am completely confused. Every time I try I ee to uncover one more version of HA. TTS is important to my attempt to ue HA for a security system What version ofHA are you using?

There’s a good discussion of the install types here.

I used the core method, which involves creating a VENV and is the most technically challenging of the installs, but you’ll learn a hell of a lot doing it. I don’t think the supervised install will run on MacOS and the HA OS method replaces the operating system entirely so you’d only do that on like an RPi (unless it can be containerized as it sounds like maybe you did with a VM). The last choice requires one to figure out Docker (which I didn’t) so I followed the technique linked in the first sentence of this entire topic.

So the discussion et forth ohttps://www.home-assistant.io/installation/macos. Is in fact two different approaches not one. That is where I went wrong. Like I sad what you are attempting with the TTS is what I really want to have. Sometime my current approach Eem like here are three different layer at the same time, Linux , HA OS and Mac OS. I think you re right about the container. I will save my current systems as I provide everything I want so far except for TTS and five the Core Approach a shot… Thanks will let you know ho it goes so others may profit from my experience I take Add On ad Intergrations still work with e Core Approach ?

ok ae ir a shot. but I depend. on Zwave. Apparently that becomes an "advanced topic"and past the installation guid and most likely beyond this noobie.

@fmon - I know this topic is years old, but it’s the one that finally got me (almost) fully sorted for whole home audio and video (in sync!) and I am tremendously grateful for your write ups.

Like - seriously - thank you!

This might be pushing my luck but I wanted to ask:

Have you ever done anything with home assistant and airfoil to control volume with a slider?

I have two Airport Express endpoints that I use with this, and they don’t expose volume controls - so I have to use airplay to set the volume of those two sets of speakers in the house. Everything else I just leave airfoil at 100% and control the volume directly on the devices.

This isn’t too hard and mostly I just set them statically when I make any of our home assistant one button switches (music or video really is the big switch we do, but also have buttons to turn/off on any of 7 speaker zones) but then I have to manually use Airfoil if I want to make an adjustment from the defaults I set. Just for those two speaker sets. All the others are “true” airplay 2 targets and I can control volume from a typical media player type slider.

I’m presuming I could so something with applescript like:

#!/bin/bash
osascript <<EOD
  tell application "Airfoil"
    get (volume of every speaker whose name starts with "speakerName")
  end tell
EOD

Get that volume and store it some helper
Set the initial value of some slider to whatever it comes back with
and then I guess?
write a script that on change of that slider would do a tell airfoil action to set volume.

That seems right, but I’m failing to come up with a way to get it to actually work and wondered if you had done anything like that already that you could share?

If not - of course no worries at all, and for real thanks a ton. Yours was the write up that got me to solve something I was banging my head against the wall on for months and months. And it’s glorious. This is just an attempt to make it a little bit better than it already is.