postlund / pyatv

A client library for Apple TV and AirPlay devices
https://pyatv.dev
MIT License
838 stars 91 forks source link

Command 'app' is not supported by device #2272

Closed remlio closed 8 months ago

remlio commented 8 months ago

Describe the bug

When I trying to get the app name that currently playing something or even to get the list of installed apps, I only receive one result: Command 'app' (or 'app_list') is not supported by device.

Error log

ERROR [pyatv.scripts.atvremote]: Command 'app' is not supported by device
Traceback (most recent call last):
  File "/home/di/.local/lib/python3.9/site-packages/pyatv/scripts/atvremote.py", line 690, in _exec_command
    tmp = getattr(obj, command)
  File "/home/di/.local/lib/python3.9/site-packages/pyatv/support/shield.py", line 72, in _guard_method
    return func(self, *args, **kwargs)
  File "/home/di/.local/lib/python3.9/site-packages/pyatv/core/facade.py", line 245, in app
    return self.relay("app")
  File "/home/di/.local/lib/python3.9/site-packages/pyatv/core/relayer.py", line 90, in relay
    instance = self._find_instance(
  File "/home/di/.local/lib/python3.9/site-packages/pyatv/core/relayer.py", line 114, in _find_instance
    raise exceptions.NotSupportedError(f"{target} is not supported")
pyatv.exceptions.NotSupportedError: app is not supported

How to reproduce the bug?

atvremote --id xx:xx:xx:xx:xx:xx --companion-credentials ‘companion-credentials’ app (or app_list)

What is expected behavior?

get the name of current playing app (or list of installed apps)

Operating System

Linux

Python

3.9

pyatv

0.14.4

Device

Apple TV 4k 2nd gen, Apple TV 4 (HD), both tvos 17.1

Additional context

On tvos 16 it worked fine

postlund commented 8 months ago

You need to pair AirPlay for that. A tip is to just run atvremote wizard, follow the instructions and after that you don't have to specify credentials manually anymore.

remlio commented 8 months ago

You need to pair AirPlay for that. A tip is to just run atvremote wizard, follow the instructions and after that you don't have to specify credentials manually anymore.

remlio commented 8 months ago

You need to pair AirPlay for that. A tip is to just run atvremote wizard, follow the instructions and after that you don't have to specify credentials manually anymore.

thank you, but it only works with the 'app' command, not with 'app_list'. app_list with airplay still shows this error:

ERROR [pyatv.scripts.atvremote]: Command 'app_list' is not supported by device Traceback (most recent call last): File "/home/di/.local/lib/python3.9/site-packages/pyatv/scripts/atvremote.py", line 696, in _exec_command value = await tmp(*args) File "/home/di/.local/lib/python3.9/site-packages/pyatv/core/facade.py", line 417, in app_list return await self.relay("app_list")() File "/home/di/.local/lib/python3.9/site-packages/pyatv/core/relayer.py", line 90, in relay instance = self._find_instance( File "/home/di/.local/lib/python3.9/site-packages/pyatv/core/relayer.py", line 114, in _find_instance raise exceptions.NotSupportedError(f"{target} is not supported") pyatv.exceptions.NotSupportedError: app_list is not supported

postlund commented 8 months ago

Did you run the Wizard with your current version? There was a bug in an older version that didn't save Companion credentials properly.

remlio commented 8 months ago

Did you run the Wizard with your current version? There was a bug in an older version that didn't save Companion credentials properly.

Yes, I did that, but didn’t see any new tips there. It just shows me list of my devices, ips, macs and supported protocols, i.e. like it always did:

ERROR [pyatv.scripts.atvremote]: Found more than one Apple TV; specify one using --id Scan Results

   Name: LG

Model/SW: xxxxx, Unknown OS Address: 10.0.1.22 MAC: xxxxx Deep Sleep: False Identifiers:

and so on, first ATV, second ATV…

postlund commented 8 months ago

If you run it correctly, it should be more like this:

$ atvremote wizard
Looking for devices...
Found the following devices:
    Name                      Model                    Address
--  ------------------------  -----------------------  -----------
 1  Receiver+                 airupnp                  10.0.10.200
 2  Receiver                  RX-V773                  10.0.10.82
 3  Pierre's AirPort Express  AirPort Express (gen 2)  10.0.10.168
 4  FakeATV                   Unknown                  10.0.10.254
 5  Vardagsrum                Apple TV 4K              10.0.10.81
 6  Apple TV                  Apple TV 3               10.0.10.83
Enter index of device to set up (q to quit): 4
Starting to set up FakeATV
Starting to pair Protocol.MRP
Enter PIN on screen: 1111
Successfully paired Protocol.MRP, moving on...
Pairing finished, trying to connect and get some metadata...
Currently playing:
  Media type: Music
Device state: Playing
       Title: Never Gonna Give You Up
      Artist: Rick Astley
    Position: 1/213s (0.0%)
      Repeat: Off
     Shuffle: Off
Device is now set up!
remlio commented 8 months ago

If you run it correctly, it should be more like this:

$ atvremote wizard
Looking for devices...
Found the following devices:
    Name                      Model                    Address
--  ------------------------  -----------------------  -----------
 1  Receiver+                 airupnp                  10.0.10.200
 2  Receiver                  RX-V773                  10.0.10.82
 3  Pierre's AirPort Express  AirPort Express (gen 2)  10.0.10.168
 4  FakeATV                   Unknown                  10.0.10.254
 5  Vardagsrum                Apple TV 4K              10.0.10.81
 6  Apple TV                  Apple TV 3               10.0.10.83
Enter index of device to set up (q to quit): 4
Starting to set up FakeATV
Starting to pair Protocol.MRP
Enter PIN on screen: 1111
Successfully paired Protocol.MRP, moving on...
Pairing finished, trying to connect and get some metadata...
Currently playing:
  Media type: Music
Device state: Playing
       Title: Never Gonna Give You Up
      Artist: Rick Astley
    Position: 1/213s (0.0%)
      Repeat: Off
     Shuffle: Off
Device is now set up!

Wow! I've never seen anything like that. In my case it’s always print of 'atvremote scan', nothing else. But I'm running exactly atvremote wizard, so why the result I get is wrong?

IMG_9809

remlio commented 8 months ago

My bad, it was old version of pyatv. I just upgraded and now it working absolutely fine. I'm sorry for bothering you about the little things. Best wishes

postlund commented 8 months ago

That was my guess, great that it works now 😊