pyatv icon indicating copy to clipboard operation
pyatv copied to clipboard

Airport Express 2 paired fine, but doesn't update the state

Open Post404 opened this issue 3 years ago • 6 comments

Describe the bug

Pairing and everything works as expected with my two airplay express 2. But the state is always Idle even though i'm playing music from my iPad (iOS 15.0.2) from Spotify. I just re-added them both to see if that worked but nothing changed.

Error log

there is no error

How to reproduce the bug?

Add an airplay express 2 device and play music from it.

What is expected behavior?

That the state would change from idle to playing when playing something.

Operating System

Home Assistant OS 6.5

Python

3.9

pyatv

0.9.5

Device

Apple Airport Express 2

Additional context

Post404 avatar Oct 23 '21 09:10 Post404

AirPlay as a protocol does not support sharing play state with third party observers, so it's technically not possible for pyatv to get the play state when someone else is streaming. I wish it was possible, but sadly it's not 😕

postlund avatar Oct 23 '21 11:10 postlund

That is to bad. And what about just a playing/pause or on/off state? I'm currently using a plug-in on homebridge to expose the airport expresses as on/off switches that works perfect for automations. I would just prefer to do it all in home assistant, that's why I'm asking here.

They are definitely using some code magic, maybe it is of use to you: https://github.com/apexad/homebridge-airport-express-playing

Post404 avatar Oct 23 '21 19:10 Post404

The protocol itself does not allow for/support that, but current state is available as a flag via zeroconf. That is exactly what the plug-in you mention is using and I have thought about doing something similar. It however requires quite some work due to the fact I don't have Zeroconf as part of architecture once connected, which means I can't get those updates. But I definitely want that in place at some point, can't give any time frame for it though.

postlund avatar Oct 23 '21 20:10 postlund

Thanks for explaining. I really hope it will be added, because the only way I have found to get this playing state in HA so far is through Homebridge. Which I ideally want to get rid of. I was also tinkering around with this I found: https://community.home-assistant.io/t/sensor-if-airport-express-2-is-playing/341247

I didn't get it to work so far but, you might still find this interesting.

Post404 avatar Nov 17 '21 09:11 Post404

I will most certainly try to fix that, it seems like an interesting challenge. But requires some internal changes as mentioned, so it's not a quick fix for it.

postlund avatar Nov 18 '21 09:11 postlund

Alright thanks!

Post404 avatar Nov 18 '21 09:11 Post404

Any update on this @postlund?

ericvoshall avatar Jan 09 '23 18:01 ericvoshall

@ericvoshall Unfortunately no, I have been quite absent from pyatv development lately. Mainly due to lack of time (family). Hopefully I can take up development soon again, there's quite a lot that needs to be done.

postlund avatar Jan 09 '23 18:01 postlund