Rather than use the Aqara sensor through HomeKit I thought it would be fun to use my airplay devices as endpoints for door chimes and what not, but I’m struggling to get it right. I anything glaringly obvious? The endpoints were added via iTunes-API and ‘door chime’ is a playlist on the iTunes server.
- id: '1594017441123'
alias: Front Door Chime
description: ''
trigger:
- entity_id: binary_sensor.0x00158d00024e4c1e_contact
from: closed
platform: state
to: open
condition: []
action:
- data:
entity_id: media_player.living_room_airtunes_speaker
media_content_id: 'doorchime'
media_content_type: 'playlist'
entity_id: media_player.living_room_airtunes_speaker
service: media_player.play_media
I’m not using the iTunes integration myself, however can you narrow down the issue a bit?
Does the sound play when you execute the automation manually?
Is there something showing up in the logs when executing it?
Thanks for the reply. I can make sounds play from iTunes media player (iTunes library), so the endpoint is definitely connected.
As for the logs, it says that automation fired and there aren’t any errors, but that’s all I’ve been able to find. Honestly I’m still a little confused. The HomePod (endpoint) is called a media player so I don’t understand if I need to include iTunes in the integration.
I though you are using this integration - is this the case?
In any case, I’d try to get it working in the Developer Tools - Services first, then create the automation based on the results.
So for example, select media_player.play_media and the correct entity_id and try to find the correct media_content_id and media_content_type
Thank you for advising me on the developer tools. It’s much easier to see what can be done there. That said, I did not find a solution. There are no errors in the output, but the command is not working. Maybe my problem is on the iTunes side. Perhaps I’ll try setting up forked-daapd again.
That wasn’t the problem, but it got me thinking, so I appreciate that. With the iTunes integration the iTunes server (running on my Mac) is used to bring in the endpoints. When I use the iTunes server in the automation, I can see that the automation is working (just without any actual speakers) so maybe I have to use the server as the media player and call the homepods separately as endpoints?
Yes, you need the 3rd party server https://github.com/maddox/itunes-api to be running on that device (make sure the firewall allows that traffic, don’t know how this works on mac)
What products are you using for your endpoints?
the server is an always on computer (and iTunes-api always runnings). The desired endpoints are homepods which were brought into hassio as airplay devices via the server integration. I added the iTunes server to Lovelace so that I could see what it was doing. The automation is definitely working. I just need to get the sound from the server to the HomePod via airplay.
Ah, I see. Good luck with that, hope you can get it working!
Can’t help you with apple stuff sadly, but I guess if you can control iTunes with the media_player service, it should only be a small step to the AirPlay stuff… right?
Dumb question perhaps, but do I need to add the endpoints to the configuration.yaml? The server is added, and it is working, so perhaps that’s my problem? Any thoughts on how to address them?
Hm, the integration page does say that they get added automatically, which makes sense since iTunes is the proxy sitting in between…
Can you control iTunes with Home Assistant? i.e. play/stop music, select a playlist?
I can definitely pause play stop via the Lovelace interface. I assume that with some configuring I could add additional functionality. I think I see where you’re going. I’ll start digging there and see if I can perhaps select an output device.
According to the integration page, every homepod thingy should be a media_player entity by itself, maybe start playing something on it via iTunes and then try to pause/play it via HA? If that works it could be an issue with the playlist name