node-appletv icon indicating copy to clipboard operation
node-appletv copied to clipboard

ATV no longer connects with tvOS 15 public beta 2 installed

Open njuart opened this issue 4 years ago • 36 comments

Hi, so it's basically stuck like this. Any ideas how to fix it? Thx in advance

image

It is stuck after sending the initial DEVICE_INFO_MESSAGE

njuart avatar Jul 03 '21 13:07 njuart

I've confirmed this is an issue with other open-source ATV libraries like pyatv as well. Like @njuart mentioned, everything just stops after DEVICE_INFO_MESSAGE is called. Could be an issue with this particular beta. The official ATV remotes are still working, however.

bsharper avatar Jul 09 '21 02:07 bsharper

I've confirmed this is an issue with other open-source ATV libraries like pyatv as well. Like @njuart mentioned, everything just stops after DEVICE_INFO_MESSAGE is called. Could be an issue with this particular beta. The official ATV remotes are still working, however.

Thx, for the input, at least something =))

njuart avatar Jul 09 '21 07:07 njuart

The official ATV remotes are still working, however.

Which remotes are you referring to in this case?

postlund avatar Jul 10 '21 06:07 postlund

The official ATV remotes are still working, however.

Which remotes are you referring to in this case?

@postlund The remote in the Control Center on iOS still works. I mentioned that because it might be possible to MITM the official remote connection and see if there's any difference with how it's working now.

bsharper avatar Jul 12 '21 02:07 bsharper

@bsharper Control center uses another protocol, Companion, that's why it is working. Possibly also in conjunction with AirPlay 2 for metadata and such (not confirmed though). From what I have gathered, I suspect that apple is getting rid of (or at least less dependent on) MRP in tvOS 15. If you use the Remote app in iOS 15 beta, it probably says to use the control center widget, right? Does the Remote app work in iOS 14 or earlier at all?

postlund avatar Jul 12 '21 07:07 postlund

@postlund Ah, I wasn't aware that the widget used the Companion protocol. Interestingly, tvOS 15 beta is still announcing _mediaremotetv._tcp via zeroconf, but maybe they haven't removed it from the announcer yet. I'm also seeing _srpl-tls._tcp from tvOS 15 beta (but not from tvOS 14) which I believe is related to the Apple's support for the new Thread protocol. That's probably more for letting Apple TV control IoT devices rather than allowing devices to control the Apple TV, but I'm not up to speed on that protocol.

I see you've done a lot of work with the Companion protocol with pyatv (the documentation under https://pyatv.dev/documentation/protocols is an incredible resource, I'm in awe of your skills). Have you had any luck sending commands (up/down/menu/select) to the ATV using Companion?

bsharper avatar Jul 13 '21 05:07 bsharper

@bsharper Yeah, I think they switched to Companion in iOS 13 (in control center). Prior to that they used MRP. I also find it a bit peculiar that they still announce the service, that's why I'm not a 100% certain they are removing it. By actually removing support for MRP, they are ditching a bunch of features which I find a bit sad if they do (e.g. additional metadata and game pad support). I just hope they don't, especially after putting so much work into reverse engineering it...

I've never heard of _srpl-tls, what makes you think it has to do with Thread/Matter? I know they already have _thread._tcp.local(IIRC, which I might #not) as my HomePod announce that.

Yeah, I've put a lot of time into Companion. There's still a lot left and by the looks of it, I might have to spend more time with it. I haven't implemented support for any remote control buttons yet (I have all the button codes though, as mentioned in the documentation), but I can try to fix that tonight. Maybe you are willing to test it for me?

postlund avatar Jul 13 '21 17:07 postlund

@postlund The reason I was thinking srpl-tls was related to thread was that Discovery (zeroconf browser) showed srpl-tls, then under the service it showed my ATV, Under the ATV there were a bunch of identifiers and a key=value pair that read: domain=openthread.thread.home.arpa. Openthread is Google's Thread implementation.

And I would be more than happy to help test this. I have both a standard ATV running tvOS 14 and a 4K model running tvOS 15 beta. Let me know when you have something for me to test and we can go from there. Thanks!

(edited to fix punctuation)

bsharper avatar Jul 14 '21 09:07 bsharper

@bsharper That was pretty much what I wanted to hear 👍 We can likely ignore that for now.

I'm working slowly on the Companion support, can hopefully finish it tomorrow or so. Just pushed support for scanning only for specific protocols, so you more easily can make atvremote ignore the MRP service and not get an error message when connect fails. I'll post here when I have something to test.

postlund avatar Jul 14 '21 21:07 postlund

@bsharper After dealing with lots of annoyances, I've managed to stitch something together here: https://github.com/postlund/pyatv/pull/1218

You can see exactly which buttons are supported if you check the source. Scroll down to the CompanionRemoteControl class. You can also do:

atvremote --debug --scan-protocols companion,airplay -s <ip> --companion-credentials <creds> features

Just replace ip and creds with your values. The same command can be used to send the commands, just change features at the end to one of them, e.g. up. Let me know if you need any help!

postlund avatar Jul 15 '21 21:07 postlund

tvOS 15.0b3 no longer announcing _mediaremotetv._tcp

Note: Living is missing.

Screen Shot 2021-07-16 at 14 05 51

elvisimprsntr avatar Jul 16 '21 18:07 elvisimprsntr

Thanks for reporting that @elvisimprsntr! It's sad, because now we lose a lot of work and we will need to put a lot of effort in to get this working again 😕

postlund avatar Jul 16 '21 19:07 postlund

@elvisimprsntr Just out of curiosity, do you know what protocol text input events are handled with from the Apple TV? I never saw events that would correlate to this over MRP when the ATV would broadcast that text input was available to any nearby paired device.

bsharper avatar Jul 20 '21 06:07 bsharper

@bsharper After dealing with lots of annoyances, I've managed to stitch something together here: postlund/pyatv#1218

@postlund I'll take a look at this shortly, I apologize for not looking sooner, I must have not seen the notification when you posted this message, or perhaps a sleeping pill got in the way... either way I'll be looking at this soon.

If I checkout the companion_rc branch and work with that, is that the best way to see your changes until the pull request is complete?

bsharper avatar Jul 20 '21 06:07 bsharper

@bsharper Yeah, checkout that branch and do python setup.py install (or develop) and you should be fine 👍

Will be interesting to see, got a report about a missing service when testing it. Let's see if you get the same.

postlund avatar Jul 20 '21 09:07 postlund

@postlund I used this code for testing: https://github.com/postlund/pyatv/blob/master/examples/pairing.py but replaced Protocol.MRP with Protocol.Companion in different combinations.

  1. When I try to scan with Protocol.Companion, I get no results, even with a much longer timeout.
  2. When I scan with Protocol.MRP it finds the ATV. If I try to pair with Protocol.MRP it throws a pyatv.exceptions.ConnectionFailedError (as expected)
  3. If I scan with Protocol.MRP then try to pair with Protocol.Companion, I get the no service error: pyatv.exceptions.NoServiceError: no service available for Protocol.Companion

Of course, this is under the assumption that scan results from MRP can be used as an input for pair using Companion, which may not be possible.

bsharper avatar Jul 20 '21 18:07 bsharper

@bsharper You need service details for the companion protocol, so just MRP won't be enough. It's easier to just use atvremote:

$ atvremote -s <ip> --protocol companion pair

Does that work?

postlund avatar Jul 20 '21 20:07 postlund

Progress! I got it paired using the companion protocol, and when I call features it returns (reformatted for brevity):

Available: Up, Down, Left, Right, PlayPause, Select, Menu, VolumeUp, VolumeDown, Home, AppList, LaunchApp, TurnOn, TurnOff Unavailable: PlayUrl

When I try to run a command like "right" I get: pyatv.exceptions.ProtocolError: Command _sessionStart failed: Unsupported service type.

Here's the full stack trace:

Traceback (most recent call last):
  File "/Users/User/opt/anaconda3/lib/python3.8/site-packages/pyatv-0.8.1-py3.8.egg/pyatv/scripts/atvremote.py", line 708, in _run_application
    return await cli_handler(loop)
  File "/Users/User/opt/anaconda3/lib/python3.8/site-packages/pyatv-0.8.1-py3.8.egg/pyatv/scripts/atvremote.py", line 497, in cli_handler
    return await _handle_commands(args, config, loop)
  File "/Users/User/opt/anaconda3/lib/python3.8/site-packages/pyatv-0.8.1-py3.8.egg/pyatv/scripts/atvremote.py", line 606, in _handle_commands
    ret = await _handle_device_command(args, cmd, atv, loop)
  File "/Users/User/opt/anaconda3/lib/python3.8/site-packages/pyatv-0.8.1-py3.8.egg/pyatv/scripts/atvremote.py", line 635, in _handle_device_command
    return await _exec_command(atv.remote_control, cmd, True, *cmd_args)
  File "/Users/User/opt/anaconda3/lib/python3.8/site-packages/pyatv-0.8.1-py3.8.egg/pyatv/scripts/atvremote.py", line 674, in _exec_command
    value = await tmp(*args)
  File "/Users/User/opt/anaconda3/lib/python3.8/site-packages/pyatv-0.8.1-py3.8.egg/pyatv/support/facade.py", line 134, in home
    return await self.relay("home")(action=action)
  File "/Users/User/opt/anaconda3/lib/python3.8/site-packages/pyatv-0.8.1-py3.8.egg/pyatv/companion/__init__.py", line 293, in home
    await self.api.hid_command(False, HidCommand.Home)
  File "/Users/User/opt/anaconda3/lib/python3.8/site-packages/pyatv-0.8.1-py3.8.egg/pyatv/companion/__init__.py", line 189, in hid_command
    await self._send_command(
  File "/Users/User/opt/anaconda3/lib/python3.8/site-packages/pyatv-0.8.1-py3.8.egg/pyatv/companion/__init__.py", line 144, in _send_command
    await self._connect()
  File "/Users/User/opt/anaconda3/lib/python3.8/site-packages/pyatv-0.8.1-py3.8.egg/pyatv/companion/__init__.py", line 132, in _connect
    await self._session_start()
  File "/Users/User/opt/anaconda3/lib/python3.8/site-packages/pyatv-0.8.1-py3.8.egg/pyatv/companion/__init__.py", line 171, in _session_start
    resp = await self._send_command(
  File "/Users/User/opt/anaconda3/lib/python3.8/site-packages/pyatv-0.8.1-py3.8.egg/pyatv/companion/__init__.py", line 163, in _send_command
    raise exceptions.ProtocolError(
pyatv.exceptions.ProtocolError: Command _sessionStart failed: Unsupported service type

bsharper avatar Jul 20 '21 21:07 bsharper

@bsharper That's more like it! Exactly the behavior I was anticipating. If you own a mac, have some free time and want to help out even more you can see my answer here: https://github.com/postlund/pyatv/issues/1168#issuecomment-883311720. I basically need to know if they changed name of the service.

postlund avatar Jul 20 '21 21:07 postlund

Let me know if this is what you're looking for, FetchLaunchableApplicationsEvent is in there:

default	16:50:09.209080-0500	rapportd	4: Received event ID '_interest', XID 0x400CF63B, 1 keys, from ed677523f119
default	16:50:09.209532-0500	rapportd	Interest register remote: Peer ed677523f119, EventID _iMC (1 total)
default	16:50:09.209690-0500	rapportd	MediaRemote changes start
default	16:50:09.209830-0500	rapportd	MediaRemote supported commands get
default	16:50:09.209978-0500	rapportd	Request: supportedCommands<83A4AAC5-81A0-44BD-93AA-5B7156939EE0> for origin-(null)-0/client--0/player-(null)
default	16:50:09.210122-0500	rapportd	Request: resolvePlayerPath<752A5EDF-BD09-4624-AE68-56BD244154EA> for origin-(null)-0/client--0/player-(null)
default	16:50:09.211606-0500	rapportd	Volume control available initial PB: yes
default	16:50:09.211982-0500	rapportd	MediaControl flags changed: < Volume >
default	16:50:09.212738-0500	rapportd	4: SendEventID '_iMC', XID 0xB9DED363, <8529156ccb2507c50e5ffc18b019153e> (53 bytes) on link type WiFi
default	16:50:09.212888-0500	rapportd	Volume control available initial: MR yes
default	16:50:09.213048-0500	rapportd	Response: resolvePlayerPath<752A5EDF-BD09-4624-AE68-56BD244154EA> returned <origin-User Room-1280262988/client-(null)/player-(null)> for origin-(null)-0/client--0/player-(null) in 0.0024 seconds
default	16:50:09.213434-0500	rapportd	4: Received requestID '_mcc', XID 0x8630CF98, 1 keys, from ed677523f119
default	16:50:09.213633-0500	rapportd	Command <GetCaptionSetting>, { "_mcc" : 12, }
default	16:50:09.215724-0500	rapportd	MediaCaptionGet: AlwaysOn
default	16:50:09.216181-0500	rapportd	4: Send response XID 0x8630CF98, <94bc9e46684b64f297a86aac5c5926e4> (43 bytes) on link type WiFi, 0/0x0 noErr
default	16:50:09.216428-0500	rapportd	Response: supportedCommands<83A4AAC5-81A0-44BD-93AA-5B7156939EE0> returned <0 commands> for origin-User Room-1280262988/client-(null)/player-(null) in 0.0066 seconds
default	16:50:09.216775-0500	rapportd	MediaRemote supported commands got: 0 items
default	16:50:09.217096-0500	rapportd	4: Received requestID '_touchStart', XID 0x8630CF99, 3 keys, from ed677523f119
default	16:50:09.217871-0500	rapportd	Touch start: { "_height" : 1000.000000, "_tFl" : 0, "_width" : 1000.000000, }
default	16:50:09.218031-0500	rapportd	4: Send response XID 0x8630CF99, <00aba531e4c3009e91ed36d3d4db63c4> (41 bytes) on link type WiFi, 0/0x0 noErr
default	16:50:09.218528-0500	rapportd	4: Received requestID '_tiStart', XID 0x8630CF9A, 0 keys, from ed677523f119
default	16:50:09.218677-0500	rapportd	TextInput start: ID 'ed677523f119', Request {}, Response {} (0 bytes)
default	16:50:09.219384-0500	rapportd	4: Send response XID 0x8630CF9A, <d1301575bc7bca642cbde16190aa6656> (37 bytes) on link type WiFi, 0/0x0 noErr
default	16:50:09.233789-0500	rapportd	4: Received requestID 'FetchLaunchableApplicationsEvent', XID 0x8630CF9B, 1 keys, from ed677523f119
default	16:50:09.238668-0500	rapportd	4: ### Sending response XID 0x8630CF9B, error: kNotHandledErr (No request handler)
default	16:50:09.239012-0500	rapportd	4: Send response XID 0x8630CF9B, <ce744a39ae09979e453f7c96a91537fc> (85 bytes) on link type WiFi, -6714/0xFFFFE5C6 kNotHandledErr
default	16:50:09.588011-0500	rapportd	NeedsCLink device found: SFDevice ID 7878e9de-b0fc-5eba-654e-cbdc3d210af4, IDS 72F5056B, 'NeedsCLink', RSSI -47 (0)~U, Nm 'iPhone', Md 'iPhone13,4', DuetSync, Hotspot 0x1E5, NeedsKeyboard, PairedBT, PairedSys Conjectured, rapportID 72F5056B-A94B-4FD2-AD96-ADA56C8711E8, WiFiP2P, DF 0xA8 < MyiCloud Ranging AirDrop >, ARS Max
default	16:50:09.588579-0500	rapportd	AirPlay advertisement preferences: enabled 1, p2p 1, intraOnly 0
default	16:50:09.588737-0500	rapportd	Enabling Bonjour AWDL advertiser as device (SFDevice ID 7878e9de-b0fc-5eba-654e-cbdc3d210af4, IDS 72F5056B, 'NeedsCLink', RSSI -47 (0)~U, Nm 'iPhone', Md 'iPhone13,4', DuetSync, Hotspot 0x1E5, NeedsKeyboard, PairedBT, PairedSys Conjectured, rapportID 72F5056B-A94B-4FD2-AD96-ADA56C8711E8, WiFiP2P, DF 0xA8 < MyiCloud Ranging AirDrop >, ARS Max) does not have target AuthTag
default	16:50:09.588819-0500	rapportd	Using Bluetooth Identitfier FA:5C:84:26:82:4A and AuthTag a536e6ce1e6d for AWDL Bonjour advertisement
default	16:50:09.589283-0500	rapportd	AirPlay advertisement preferences: enabled 1, p2p 1, intraOnly 0
default	16:50:09.589353-0500	rapportd	Bonjour AWDL advertiser start: CUBonjourAdvertiser _companion-link._tcp, Name 'CLink-bbc9c92da5e4', Port 49153, AdvFlags 0x800, Domain 'local.', IfName 'awdl0', TXT { "rpBA" : "FA:5C:84:26:82:4A", "rpFl" : "0x4800", "rpAD" : "a536e6ce1e6d", "rpMRtID" : "58D2CB18-856B-4B09-A510-F02A92ADAAF8", "rpNm" : "User Room", "rpVr" : "300.56", }
default	16:50:09.589526-0500	rapportd	CLink: Activate '_companion-link._tcp'
default	16:50:09.589600-0500	rapportd	CLink: Update TXT: { "rpBA" : "FA:5C:84:26:82:4A", "rpFl" : "0x4800", "rpAD" : "a536e6ce1e6d", "rpMRtID" : "58D2CB18-856B-4B09-A510-F02A92ADAAF8", "rpNm" : "User Room", "rpVr" : "300.56", }

bsharper avatar Jul 20 '21 21:07 bsharper

@bsharper Huh, interesting. It actually returns kNotHandledErr. That's basically what the failing session setup in pyatv is supposed to fix. I assume you got the list in the Shortcuts app? Can you find any other instances of FetchLaunchableApplicationsEvent? Do you see any _sessionStart? In case you do (for any of them), I would be interested in some logs for those too!

postlund avatar Jul 20 '21 22:07 postlund

@postlund Yes actually now I'm getting an error in the Shortcuts app:

Open App on Apple TV was unable to get the list of apps from "User Room". Make sure your Apple TV is running the latest software.

I tried that from both a beta and non-beta iOS device.

Fortunately I do temporarily have a 2nd ATV running tvOS 14 standard / non-beta. Let me try it on that, one sec.

bsharper avatar Jul 20 '21 22:07 bsharper

@postlund This time the app list populated in Shortcuts. This is from an ATV running tvOS 14.6

default	17:39:33.266624-0500	rapportd	2: Received requestID '_sessionStart', XID 0xC0E7C175, 3 keys, from ed677523f119
default	17:39:33.267210-0500	rapportd	Session start received: Service com.apple.tvremoteservices, PeerID ed677523f119, SID 0xA73A9B597ECA0DC8, Token 1
default	17:39:33.268135-0500	rapportd	XPC publisher triggered: token 1
default	17:39:33.270679-0500	rapportd	XPC publisher reply: token 1, {}
default	17:39:33.270893-0500	rapportd	2: Send response XID 0xC0E7C175, <08e7f6d836882967317df0d124761da1> (51 bytes), 0/0x0 noErr
default	17:39:33.280973-0500	rapportd	2: Received event ID '_interest', XID 0x400CF64B, 1 keys, from ed677523f119
default	17:39:33.281589-0500	rapportd	Interest register remote: Peer ed677523f119, EventID _iMC (1 total)
default	17:39:33.281821-0500	rapportd	MediaRemote changes start
default	17:39:33.282563-0500	rapportd	MediaRemote supported commands get
default	17:39:33.284177-0500	rapportd	Request: supportedCommands<8BCB3348-9D12-4989-A11B-8BBAD93AC80F> for origin-(null)-0/client--0/player-(null)
default	17:39:33.285187-0500	rapportd	Request: resolvePlayerPath<D078E2FB-6B81-4409-81CF-F7022BD5DBC0> for origin-(null)-0/client--0/player-(null)
default	17:39:33.289727-0500	rapportd	Volume control available initial PB: yes
default	17:39:33.289942-0500	rapportd	MediaControl flags changed: < Volume >
default	17:39:33.290086-0500	rapportd	2: SendEventID '_iMC', XID 0xA1F22D9, <b26bf10c1015d466ae3a4eca97d0e354> (49 bytes)
default	17:39:33.290220-0500	rapportd	Volume control available initial: MR yes
default	17:39:33.290355-0500	rapportd	2: Received requestID '_mcc', XID 0xC0E7C176, 1 keys, from ed677523f119
default	17:39:33.291059-0500	rapportd	Command <GetCaptionSetting>, { "_mcc" : 12, }
default	17:39:33.298403-0500	rapportd	Response: resolvePlayerPath<D078E2FB-6B81-4409-81CF-F7022BD5DBC0> returned <origin-Apple TV-1280262988/client-(null)/player-(null)> for origin-(null)-0/client--0/player-(null) in 0.0136 seconds
default	17:39:33.300251-0500	rapportd	MediaCaptionGet: ForcedOnly
default	17:39:33.300724-0500	rapportd	2: Send response XID 0xC0E7C176, <6e9b6f82c8d466e75c9952ff3b881d26> (43 bytes), 0/0x0 noErr
default	17:39:33.300833-0500	rapportd	2: Received requestID '_touchStart', XID 0xC0E7C177, 3 keys, from ed677523f119
default	17:39:33.300924-0500	rapportd	Touch start: { "_height" : 1000.000000, "_tFl" : 0, "_width" : 1000.000000, }
default	17:39:33.301012-0500	rapportd	2: Send response XID 0xC0E7C177, <433ef4147f191b8e2ec801918c905acb> (41 bytes), 0/0x0 noErr
default	17:39:33.301305-0500	rapportd	Response: supportedCommands<8BCB3348-9D12-4989-A11B-8BBAD93AC80F> returned <0 commands> for origin-Apple TV-1280262988/client-(null)/player-(null) in 0.0175 seconds
default	17:39:33.301981-0500	rapportd	MediaRemote supported commands got: 0 items
default	17:39:33.302110-0500	rapportd	2: Received requestID '_tiStart', XID 0xC0E7C178, 0 keys, from ed677523f119
default	17:39:33.302293-0500	rapportd	TextInput start: ID 'ed677523f119', Request {}, Response {} (0 bytes)
default	17:39:33.302531-0500	rapportd	2: Send response XID 0xC0E7C178, <87a2a6329ea0632a8d9959a3503fc20b> (37 bytes), 0/0x0 noErr
default	17:39:33.312338-0500	rapportd	2: Received requestID 'FetchLaunchableApplicationsEvent', XID 0xC0E7C179, 1 keys, from ed677523f119
default	17:39:33.314660-0500	TVRemoteConnectionService	XPC: Received TVRCFetchLaunchableApplicationsEvent request
default	17:39:33.315623-0500	TVRemoteConnectionService	SendResponseID 'FetchLaunchableApplicationsEvent', 73 keys
default	17:39:33.319998-0500	rapportd	2: Send response XID 0xC0E7C179, <18f5cdc171bf16bc0f10d3ba52b0c79b> (2378 bytes), 0/0x0 noErr

bsharper avatar Jul 20 '21 22:07 bsharper

Progress! I got it paired using the companion protocol, and when I call features it returns (reformatted for brevity):

Available: Up, Down, Left, Right, PlayPause, Select, Menu, VolumeUp, VolumeDown, Home, AppList, LaunchApp, TurnOn, TurnOff

Unavailable: PlayUrl

When I try to run a command like "right" I get:

pyatv.exceptions.ProtocolError: Command _sessionStart failed: Unsupported service type.

Here's the full stack trace:


Traceback (most recent call last):

  File "/Users/User/opt/anaconda3/lib/python3.8/site-packages/pyatv-0.8.1-py3.8.egg/pyatv/scripts/atvremote.py", line 708, in _run_application

    return await cli_handler(loop)

  File "/Users/User/opt/anaconda3/lib/python3.8/site-packages/pyatv-0.8.1-py3.8.egg/pyatv/scripts/atvremote.py", line 497, in cli_handler

    return await _handle_commands(args, config, loop)

  File "/Users/User/opt/anaconda3/lib/python3.8/site-packages/pyatv-0.8.1-py3.8.egg/pyatv/scripts/atvremote.py", line 606, in _handle_commands

    ret = await _handle_device_command(args, cmd, atv, loop)

  File "/Users/User/opt/anaconda3/lib/python3.8/site-packages/pyatv-0.8.1-py3.8.egg/pyatv/scripts/atvremote.py", line 635, in _handle_device_command

    return await _exec_command(atv.remote_control, cmd, True, *cmd_args)

  File "/Users/User/opt/anaconda3/lib/python3.8/site-packages/pyatv-0.8.1-py3.8.egg/pyatv/scripts/atvremote.py", line 674, in _exec_command

    value = await tmp(*args)

  File "/Users/User/opt/anaconda3/lib/python3.8/site-packages/pyatv-0.8.1-py3.8.egg/pyatv/support/facade.py", line 134, in home

    return await self.relay("home")(action=action)

  File "/Users/User/opt/anaconda3/lib/python3.8/site-packages/pyatv-0.8.1-py3.8.egg/pyatv/companion/__init__.py", line 293, in home

    await self.api.hid_command(False, HidCommand.Home)

  File "/Users/User/opt/anaconda3/lib/python3.8/site-packages/pyatv-0.8.1-py3.8.egg/pyatv/companion/__init__.py", line 189, in hid_command

    await self._send_command(

  File "/Users/User/opt/anaconda3/lib/python3.8/site-packages/pyatv-0.8.1-py3.8.egg/pyatv/companion/__init__.py", line 144, in _send_command

    await self._connect()

  File "/Users/User/opt/anaconda3/lib/python3.8/site-packages/pyatv-0.8.1-py3.8.egg/pyatv/companion/__init__.py", line 132, in _connect

    await self._session_start()

  File "/Users/User/opt/anaconda3/lib/python3.8/site-packages/pyatv-0.8.1-py3.8.egg/pyatv/companion/__init__.py", line 171, in _session_start

    resp = await self._send_command(

  File "/Users/User/opt/anaconda3/lib/python3.8/site-packages/pyatv-0.8.1-py3.8.egg/pyatv/companion/__init__.py", line 163, in _send_command

    raise exceptions.ProtocolError(

pyatv.exceptions.ProtocolError: Command _sessionStart failed: Unsupported service type

From the looks of this:

Available: Up, Down, Left, Right, PlayPause, Select, Menu, VolumeUp, VolumeDown, Home, AppList, LaunchApp, TurnOn, TurnOff

I'd say the change is necessitated by the new ATV remote design?

gasdiver avatar Jul 21 '21 03:07 gasdiver

@postlund Yes actually now I'm getting an error in the Shortcuts app:

Open App on Apple TV was unable to get the list of apps from "User Room". Make sure your Apple TV is running the latest software.

I tried that from both a beta and non-beta iOS device.

Fortunately I do temporarily have a 2nd ATV running tvOS 14 standard / non-beta. Let me try it on that, one sec.

Maybe we can conclude that something is broken in tvOS then? If the official shortcut doesn't work, it's hard for me to do anything. Let's hope it gets fixed in the next beta. Poor quality control on Apples part...

postlund avatar Jul 21 '21 06:07 postlund

From the looks of this:

Available: Up, Down, Left, Right, PlayPause, Select, Menu, VolumeUp, VolumeDown, Home, AppList, LaunchApp, TurnOn, TurnOff

I'd say the change is necessitated by the new ATV remote design?

Not all commands need that service from what I've gathered. I added the _sessionStart call because the all functions failed, more details in #1034. Removing the session start will likely make navigation buttons working:

https://github.com/postlund/pyatv/blob/271c3196161bd2271c770d8bc5a1a7edefaa4afa/pyatv/companion/init.py#L115

Maybe someone can do that and verify with tvOS 15? If it works, I can clean up and finish the commit to merge it later tonight.

postlund avatar Jul 21 '21 06:07 postlund

@postlund I commented out that line and tried some of the navigation commands.

For example: atvremote --debug --scan-protocols companion,airplay -s 192.168.X.X --companion-credentials $(cat ~/.companion_creds.txt) right

With _sessionStart commented out, the command doesn't error out or anything, it stops at a[pyatv.companion.protocol]: Receive OPACK line and nothing happens on the ATV. With _sessionStart back in it starts with the same output but continues with [pyatv.support.hap_srp]: Keys until finally Command _sessionStart failed: Unsupported service type. This doesn't result in any action from the ATV either.

Let me know if I should have done something differently. I'm still using the code from the companion_rc branch.

bsharper avatar Jul 21 '21 20:07 bsharper

@bsharper Ok, that is interesting. Does turn_off work for instance? That has worked in the past (or rather, it works in tvOS 14)? Can you include a log snippet from one of the command, so I can see what's going on? Can you try it on tvOS 14 S well? You shouldn't have to remove _sessionStart in that case.

postlund avatar Jul 21 '21 21:07 postlund

@postlund It does! Both turn_on and turn_off work on tvOS 15 beta. I can't pair tvOS 14 using atvremote -s 192.168.X.X --protocol companion pair.

It gives me the error:

ERROR [root]: Could not find any Apple TV on current network

I've double-checked the IP, pairing using the companion protocol on tvOS 14 doesn't seem to work.

But this is good, I think other than pairing I haven't seen tvOS 15 respond to any of the companion commands until now.

bsharper avatar Jul 21 '21 21:07 bsharper

@bsharper Woah, that is peculiar to say the least. I would expect pairing Companion on tvOS 14 to work just fine. I assume you are on the same VLAN as that device? Does atvremote scan find it?

postlund avatar Jul 21 '21 21:07 postlund