pyatv: Home Assistant integration does not work with tvOS 15
Describe the bug
An aborted noted popped up every time when I try to add my Apple TV into hass.
Error log
<place log here>
How to reproduce the bug?
After typed in the PIN code displayed on Apple TV.
What is expected behavior?
Successfully add Apple TV Integration.
Operating System
core-2021.9.7
Python
Other
pyatv
not sure
Device
Apple TV 4K tvOS 15.0(19J346)
Additional context
Using tvOS 15.0(19J346) on my Apple TV 4K.
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Reactions: 4
- Comments: 91 (33 by maintainers)
https://github.com/home-assistant/core/pull/58665 has been merged to core, so the release in January will have the updated component bundled! 🎉
Hopefully I will be able to implement some more stuff before then.
@postlund since you started requiring HAss 2021.11. 0 it’s no longer possible to install ANY version using HACS which is a bit of an issue as I updated to 1.7.0 which didn’t work out, so when I went to roll back to 1.6.0 it won’t let me.
@Qonstrukt Sorry about the late response here, no excuses for that. So, here is my theory. The media player will report
standby
whenever pyatv reports that power state isOff
. There is no “proper” off state in any of the known protocols so far, but we use a parameter calledlogicalDeviceCount
which seems to correlate to the number of active output devices. Basically if HDMI is active, then it is 1 otherwise it is 0. Since the Apple TV can be used passively for audio streaming, like you do, this becomes a problem. It’s obviously strange that the device can report power state “off” while still playing some media… So, one fix would be to change the power state to “on” whenever something is playing (or rather, when the device is not “idle”). One problem is that the power state will jump back and forth between on and off whenever plays or not. But that might be the best solution I guess, what do you think?Edit: Created #1500 for this.
@ruant It’s not marked as MUST in the specification, but SHOULD. It’s all in here:
https://datatracker.ietf.org/doc/html/rfc6762#section-5.5
It is all very reasonable and in my opinion it would have been better to just force that as part of the specification to begin with. Anyhow, re-mapping IP address with NAT certainly works as the makes the source IP correct. It’s not for the faint of heart though.
On another note… I decided that it’s time to start integrating with Home Assistant since that will probably take a while, so a PR is now open here: https://datatracker.ietf.org/doc/html/rfc6762#section-5.5
@lafferlaffer Yeah, that’s the reason. I should not have left it in this state. You either have to revert to the previous version and remove the integrations before updating or manually remove them from
.storage/core.config_entries
. Hopefully this will not be a problem in future updates.Updating to Beta fixed my MRP pairing failure 🙌🏻
@filikun Yes, it is most likely the case. It’s a reasonable restriction, so I’m not that surprised. I’m re-working the message handling in Companion to support events, which will allow me to handle this case in a more elegant fashion. Would be great to have yet someone else confirm this, just to be sure.
So far so good. Ran multiple test today with Netflix and Disney+ and it’s running fine. No problems so far.
Hi,
I’ve installed the beta component and it sees all my Apple TV’s, and can integrate them with the pairing codes, although I do get the same error above, but HA still can’t see their state. I have all my light automations set up to dim based on their playing, paused etc. state. Feels like I’m back in the 80s having to manually dim the lights.
Apple TV state in HA just says Off. I did remove he, from HA before installing the beta component, and they have been detected but the integration isn’t working yet.
Thanks so much for your hard work on this. Really appreciate it and I really miss this function not working.
Where do I have to look for? I can’t seem to find the beta in HACS.