Closed markus-ta closed 6 months ago
It sounds to me like you have not provided credentials properly? if you are running pyatv prior to 0.14.0, you need to manually specify --xxx-credentials
for each protocol (with the credentials you got during pairing). If you are running 0.14.0, the credentials should have been saved to storage automatically. What version are you running?
Followed the getting started guide and tutorial yesterday so I suppose I'm running 0.14.0
If you check the output of atvremote scan
or atvremote -s <ip> print_settings
, do you see credentials for each protocol or are they null?
If I run atvremote scan
credentials are None
and the same with atvremote -s <ip> print_settings
Then the credentials weren't saved properly for some reason. Try running atvremote wizard
(again, assuming you use that last time?) and try to catch if you get any errors. Then verify if credentials are present again.
Are you running in docker btw? if you are, then you need to make sure that you mount a volume where the configuration file can be saved otherwise you'll lose it when the container stops (~/.pyatv.conf
).
Ok, thanks you so much. Im going to check this during the weekend :)
Hi there, I have the same issue. Here's some detail:
hoolio@monitor:~:$ atvremote wizard
Looking for devices...
Found the following devices:
Name Model Address
-- ----------- ------------------- ----------
1 Lounge Room Apple TV 4K (gen 3) 10.1.1.131
Enter index of device to set up (q to quit): 1
Starting to set up Lounge Room
Starting to pair Protocol.Companion
Enter PIN on screen: 6315
Successfully paired Protocol.Companion, moving on...
Starting to pair Protocol.AirPlay
Enter PIN on screen: 4553
Successfully paired Protocol.AirPlay, moving on...
Starting to pair Protocol.RAOP
Enter PIN on screen: 0889
Successfully paired Protocol.RAOP, moving on...
Pairing finished, trying to connect and get some metadata...
Currently playing:
Media type: Music
Device state: Playing
Title: So Far Away - Full Version
Artist: Dire Straits
Album: Brothers In Arms - 20th Anniversary Edition
Position: 20/312s (6.4%)
Repeat: Off
Shuffle: Off
Device is now set up!
hoolio@monitor:~:$ cat .pyatv.conf
{"version": 1, "devices": [{"protocols": {"airplay": {"identifier": "A8:51:AB:07:FD:3B"}, "companion": {"identifier": "2B96147B-7F2F-42BE-9297-4CCB88ACE7F8"}, "raop": {"identifier": "A851AB07FD3B"}}}]}
hoolio@monitor:~:$ atvremote -s 10.1.1.131 print_settings
info.name = pyatv (str)
info.mac = 02:70:79:61:74:76 (str)
info.model = iPhone10,6 (str)
info.device_id = FF:70:79:61:74:76 (str)
info.os_name = iPhone OS (str)
info.os_build = 18G82 (str)
info.os_version = 14.7.1 (str)
protocols.airplay.identifier = A8:51:AB:07:FD:3B (str, NoneType)
protocols.airplay.credentials = None (str, NoneType)
protocols.airplay.password = None (str, NoneType)
protocols.companion.identifier = 2B96147B-7F2F-42BE-9297-4CCB88ACE7F8 (str, NoneType)
protocols.companion.credentials = None (str, NoneType)
protocols.dmap.identifier = None (str, NoneType)
protocols.dmap.credentials = None (str, NoneType)
protocols.mrp.identifier = None (str, NoneType)
protocols.mrp.credentials = None (str, NoneType)
protocols.raop.identifier = A851AB07FD3B (str, NoneType)
protocols.raop.credentials = None (str, NoneType)
protocols.raop.password = None (str, NoneType)
and all the various commands fail eg:
hoolio@monitor:~:$ atvremote --id A8:51:AB:07:FD:3B power_state
2023-09-17 09:14:42 ERROR [pyatv.scripts.atvremote]: Command 'power_state' is not supported by device
Traceback (most recent call last):
File "/usr/local/lib/python3.9/dist-packages/pyatv/scripts/atvremote.py", line 935, in _exec_command
tmp = getattr(obj, command)
File "/usr/local/lib/python3.9/dist-packages/pyatv/support/shield.py", line 72, in _guard_method
return func(self, *args, **kwargs)
File "/usr/local/lib/python3.9/dist-packages/pyatv/core/facade.py", line 320, in power_state
return self.relay("power_state")
File "/usr/local/lib/python3.9/dist-packages/pyatv/core/relayer.py", line 90, in relay
instance = self._find_instance(
File "/usr/local/lib/python3.9/dist-packages/pyatv/core/relayer.py", line 114, in _find_instance
raise exceptions.NotSupportedError(f"{target} is not supported")
pyatv.exceptions.NotSupportedError: power_state is not supported
hoolio@monitor:~:$ atvremote --id A8:51:AB:07:FD:3B screensaver
2023-09-17 09:14:45 ERROR [pyatv.scripts.atvremote]: Command 'screensaver' is not supported by device
Traceback (most recent call last):
File "/usr/local/lib/python3.9/dist-packages/pyatv/scripts/atvremote.py", line 941, in _exec_command
value = await tmp(*args)
File "/usr/local/lib/python3.9/dist-packages/pyatv/core/facade.py", line 191, in screensaver
return await self.relay("screensaver")()
File "/usr/local/lib/python3.9/dist-packages/pyatv/core/relayer.py", line 90, in relay
instance = self._find_instance(
File "/usr/local/lib/python3.9/dist-packages/pyatv/core/relayer.py", line 114, in _find_instance
raise exceptions.NotSupportedError(f"{target} is not supported")
pyatv.exceptions.NotSupportedError: screensaver is not supported
I had thought it might be an issue with missing dependencies or something up with the sudo pip (ie: lazy) install. It took me awhile to dig the requirements.txt up but then installed them in a clean python venv (conda) with:
(pyatv) hoolio@mbp:~:$ wget https://raw.githubusercontent.com/postlund/pyatv/master/base_versions.txt
(pyatv) hoolio@mbp:~:$ pip install -r base_versions.txt
However it didn't seem to make any difference in my case.
That is really strange actually. I see two potential issues here: either settings aren't saved at all or the storage thinks nothing has changed after pairing and does not store the changes. Can you try removing ~pyatv.conf
, then run the wizard exactly once and check the content? If you see the same thing that you pasted above, it would suggest that credentials aren't put correctly into storage. The next thing to test would be to run for instance atvremote -s <ip> --raop-password test playing
and see if the password is stored properly.
test 1 (rm config file)
(pyatv) hoolio@mbp:/opt/miniconda3/envs:$ rm ~/.pyatv.conf
(pyatv) hoolio@mbp:/opt/miniconda3/envs:$ atvremote wizard
Looking for devices...
Found the following devices:
Name Model Address
-- ----------- ------------------- ----------
1 Lounge Room Apple TV 4K (gen 3) 10.1.1.131
Enter index of device to set up (q to quit): 1
Starting to set up Lounge Room
Starting to pair Protocol.Companion
Enter PIN on screen: 3446
Successfully paired Protocol.Companion, moving on...
Starting to pair Protocol.AirPlay
Enter PIN on screen: 7215
Successfully paired Protocol.AirPlay, moving on...
Starting to pair Protocol.RAOP
Enter PIN on screen: 7247
Successfully paired Protocol.RAOP, moving on...
Pairing finished, trying to connect and get some metadata...
Currently playing:
Media type: Music
Device state: Playing
Title: Night Falls
Artist: Booka Shade
Album: Movements
Position: 285/319s (89.3%)
Repeat: Off
Shuffle: Off
Device is now set up!
(pyatv) hoolio@mbp:/opt/miniconda3/envs:$ cat ~/.pyatv.conf
{"version": 1, "devices": [{"protocols": {"airplay": {"identifier": "A8:51:AB:07:FD:3B"}, "companion": {"identifier": "2B96147B-7F2F-42BE-9297-4CCB88ACE7F8"}, "raop": {"identifier": "A851AB07FD3B"}}}]}
(pyatv) hoolio@mbp:/opt/miniconda3/envs:$ atvremote -s 10.1.1.131 print_settings
info.name = pyatv (str)
info.mac = 02:70:79:61:74:76 (str)
info.model = iPhone10,6 (str)
info.device_id = FF:70:79:61:74:76 (str)
info.os_name = iPhone OS (str)
info.os_build = 18G82 (str)
info.os_version = 14.7.1 (str)
protocols.airplay.identifier = A8:51:AB:07:FD:3B (str, NoneType)
protocols.airplay.credentials = None (str, NoneType)
protocols.airplay.password = None (str, NoneType)
protocols.companion.identifier = 2B96147B-7F2F-42BE-9297-4CCB88ACE7F8 (str, NoneType)
protocols.companion.credentials = None (str, NoneType)
protocols.dmap.identifier = None (str, NoneType)
protocols.dmap.credentials = None (str, NoneType)
protocols.mrp.identifier = None (str, NoneType)
protocols.mrp.credentials = None (str, NoneType)
protocols.raop.identifier = A851AB07FD3B (str, NoneType)
protocols.raop.credentials = None (str, NoneType)
protocols.raop.password = None (str, NoneType)
(pyatv) hoolio@mbp:/opt/miniconda3/envs:$ atvremote --id A8:51:AB:07:FD:3B screensaver
2023-09-17 17:03:10 ERROR [pyatv.scripts.atvremote]: Command 'screensaver' is not supported by device
Traceback (most recent call last):
File "/opt/miniconda3/envs/pyatv/lib/python3.11/site-packages/pyatv/scripts/atvremote.py", line 941, in _exec_command
value = await tmp(*args)
^^^^^^^^^^^^^^^^
File "/opt/miniconda3/envs/pyatv/lib/python3.11/site-packages/pyatv/core/facade.py", line 191, in screensaver
return await self.relay("screensaver")()
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/miniconda3/envs/pyatv/lib/python3.11/site-packages/pyatv/core/relayer.py", line 90, in relay
instance = self._find_instance(
^^^^^^^^^^^^^^^^^^^^
File "/opt/miniconda3/envs/pyatv/lib/python3.11/site-packages/pyatv/core/relayer.py", line 114, in _find_instance
raise exceptions.NotSupportedError(f"{target} is not supported")
pyatv.exceptions.NotSupportedError: screensaver is not supported
test 2 (while actually playing something in Spotify)
(pyatv) hoolio@mbp:/opt/miniconda3/envs:$ atvremote -s 10.1.1.131 --raop-password test playing
Media type: Unknown
Device state: Idle
fyi fwiw
(pyatv) hoolio@mbp:/opt/miniconda3/envs:$ pip freeze
aiohttp==3.8.3
aiosignal==1.3.1
annotated-types==0.5.0
async-timeout==4.0.2
attrs==23.1.0
certifi==2023.7.22
cffi==1.15.1
chacha20poly1305-reuseable==0.0.3
chardet==3.0.4
charset-normalizer==2.1.1
cryptography==36.0.2
frozenlist==1.4.0
idna==2.10
ifaddr==0.1.7
mediafile==0.8.1
miniaudio==1.45
multidict==6.0.4
mutagen==1.47.0
protobuf==4.22.0
pyatv==0.14.0
pycparser==2.21
pydantic==2.3.0
pydantic-extra-types==2.1.0
pydantic-settings==2.0.2
pydantic_core==2.6.3
python-dotenv==1.0.0
requests==2.23.0
six==1.16.0
srptools==0.2.0
tabulate==0.9.0
typing_extensions==4.7.1
urllib3==1.25.11
yarl==1.9.2
zeroconf==0.72.0
Oh, this is such a stupid mistake on my end (not sure how I missed this). Can you try changing this line:
Into this instead:
pairing = await pair(conf, service.protocol, self.loop, storage=self.storage)
Then try the wizard again?
I have merged the fix in #2195, so hopefully it will work now. Would be great if someone of you could test it, I'll make a release afterwards.
works fine :) thx mate.
(pyatv) hoolio@mbp:/opt/miniconda3:$ atvremote --id A8:51:AB:07:FD:3B power_state
PowerState.On
I suppose we can close this!
What do you need help with?
Hi!
I'm successful with the scan and pairing, the pyatv appears in the Apple TV remote list but none of the remote commands are working, I get unsupported and when I check the features, all of them are listed as unavailable. What do I miss?
Best regards Markus