I didn’t find anything, but look at this log. Do I have to fix something?
Hi,
Great job on making this new integration. I had a lot of this working about a year ago via node-red/HA and found a lot has changed with TVOS and now have to design/build it again. Oh well (I was using Alexa as my trigger device, moving to HomeKit now as HomePod and many other apple devices with Siri).
Just found that the code syntax you had did not work for me in HA (developer -> services), it gave me an error (see screenshot)
I found that this works (noting that just holding home no longer puts the APV to sleep, you have to hit select as well, might be an TVOS 14 thing)
entity_id: remote.appletv
device: 32756745
command:
- home_hold
- select
delay_secs: 0.75
Hi,
I’ve switched from homebridge to HASS and I’m glad to see pyATV on this platform.
Works well on a docker with hass.io but got an error with a chroot with Debian Buster 10.6 + Python 3.8.6 + HASS 0.118.4:
2020-12-01 08:57:00 ERROR (MainThread) [aiohttp.server] Error handling request
Traceback (most recent call last):
File "/srv/homeassistant/lib/python3.8/site-packages/aiohttp/web_protocol.py", line 422, in _handle_request
resp = await self._request_handler(request)
File "/srv/homeassistant/lib/python3.8/site-packages/aiohttp/web_app.py", line 499, in _handle
resp = await handler(request)
File "/srv/homeassistant/lib/python3.8/site-packages/aiohttp/web_middlewares.py", line 118, in impl
return await handler(request)
File "/srv/homeassistant/lib/python3.8/site-packages/homeassistant/components/http/request_context.py", line 18, in request_context_middleware
return await handler(request)
File "/srv/homeassistant/lib/python3.8/site-packages/homeassistant/components/http/ban.py", line 72, in ban_middleware
return await handler(request)
File "/srv/homeassistant/lib/python3.8/site-packages/homeassistant/components/http/auth.py", line 127, in auth_middleware
return await handler(request)
File "/srv/homeassistant/lib/python3.8/site-packages/homeassistant/components/http/view.py", line 129, in handle
result = await result
File "/srv/homeassistant/lib/python3.8/site-packages/homeassistant/components/config/config_entries.py", line 136, in post
return await super().post(request)
File "/srv/homeassistant/lib/python3.8/site-packages/homeassistant/components/http/data_validator.py", line 60, in wrapper
result = await method(view, request, *args, **kwargs)
File "/srv/homeassistant/lib/python3.8/site-packages/homeassistant/helpers/data_entry_flow.py", line 69, in post
result = await self._flow_mgr.async_init(
File "/srv/homeassistant/lib/python3.8/site-packages/homeassistant/data_entry_flow.py", line 130, in async_init
result = await self._async_handle_step(
File "/srv/homeassistant/lib/python3.8/site-packages/homeassistant/data_entry_flow.py", line 213, in _async_handle_step
result: Dict = await getattr(flow, method)(user_input)
File "/home/homeassistant/.homeassistant/custom_components/apple_tv/config_flow.py", line 137, in async_step_user
self.scan_result, _ = await device_scan(None, self.hass.loop)
File "/home/homeassistant/.homeassistant/custom_components/apple_tv/config_flow.py", line 76, in device_scan
scan_result = await scan(loop, hosts=hosts, timeout=timeout)
File "/srv/homeassistant/lib/python3.8/site-packages/pyatv/__init__.py", line 49, in scan
devices = (await scanner.discover(timeout)).values()
File "/srv/homeassistant/lib/python3.8/site-packages/pyatv/support/scan.py", line 205, in discover
responses = await mdns.multicast(
File "/srv/homeassistant/lib/python3.8/site-packages/pyatv/support/mdns.py", line 585, in multicast
await protocol.add_socket(net.mcast_socket(None, 5353))
File "/srv/homeassistant/lib/python3.8/site-packages/pyatv/support/net.py", line 67, in mcast_socket
sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEPORT, 1)
OSError: [Errno 92] Protocol not available
Needed to patch net.py like this to get it work:
if hasattr(socket, "SO_REUSEPORT"):
sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
Strange.
By the way, Pierre, did you see the new AppleTV remote controller implementation on Hap-nodejs?
I’ve played with Siri commands and patched it to send recorded sentences: magic to launch an App or select TV channel!
Hey @postlund - First of all, thanks a lot for your excellent work in this. Much appreciated.
Not sure if this thread is the best place to ask, but it was one of the top results in Google.
I added my 2x Apple TV 4K to HA after this integration became official in the HA 2012.12 version.
I have noticed that when the Apple TVs are not in use, the media_player state is constantly switching between “idle” and “unknown” (and at the same time the remote state is switching between “on” and “off”). This happens approximately every 20 seconds, so often that it totally floods the state history and my browser actually freezes when I try to view the history of either the media_player or the remote.
So I was wondering if this is normal, or if there is anything I can do to fix this?
I can always work around this by excluding the entities from the recorder, but it would be nice to have the history available.
That does not sound normal. Please check the log first and foremost, you should hopefully find something there.
Hei Pål, Jeg tar for gitt at du har sett denne tråden:
Did you resolve that issue? I have the same.
Hi
I have been busy so I did not spend any time on it. I just did a workaround where I excluded the appletv entities from the recorder to avoid filling up the database with these messages. However I noticed some memory leak issues as well due to this, so I just disabled the integration as I don’t depend on it currently.
I have a suspicion it might be related to the appletv devices being connected via wifi, so I will test with cable for one of my devices which will be easy to connect, to see if it helps.
Meanwhile i found a workaround - I switched from Ethernet to Wifi - since then it is working as expected.
I suppose that the issue is realted to an Multicast incompatible Powerline Device which causes Multicast flooding.
The same is possible with a wifi repeater which is not multicast (IGMPv3) capable. Which applies for most cheap models.
Thanks for sharing, that’s quite interesting. I was running the appletv devices and the Home Assistant NUC on the same wifi (TP-Link Deco X60 mesh with 3 nodes), so I will check if there is something I can adjust in there. But typically these home usage mesh systems have limited configuration options.
Have a look at “IGMP Proxy and Snooping”
Has any progress been made on the integration that will allow for the select_source yet? I’m trying to integrate my AppleTV (running tvOS 14.x). I can see the status information when something is playing, but I can’t control anything other than the play/pause. I’ve tried creating scripts that use the up/down/left/right command from the remote, but they only work if the AppleTV is on the main screen, with nothing already playing. Being able to select the source using just the app name would be really useful.
That will come quite soon, but use the media browser as that seems to be what others do.
I have updated apple tv to version 15 beta and I can no longer integrate it into the home assistant? do you know how to do it?
the network sometimes sees it, other times it doesn’t and sometimes it asks only for the first pin while the second doesn’t ask for it, Thanks
Doesn’t work with tvOS 15. Apple has removed MRP so there’s no way to communicate anymore (at least for now). No timeframe for a solution.
it is possible to downgrade to ios 14?
No idea, I’ve never run any beta version. But I assume it should be possible, at least until final version is out.
So once 15 is released we will all lose the ability to use the ATV integration? Or is this a beta thing?
Looks like that is the case, yes. Unless something changes in a late beta.