Open KibosJ opened 3 years ago
Yea, I see this too. The plugin just logs
[6/13/2021, 7:04:55 PM] [Apple TV Platform] [Apple HB] Error while connecting: Error: Apple TV not found while scanning.
[6/13/2021, 7:04:58 PM] [Apple TV Platform] [Apple HB] Error while connecting: Error: Apple TV not found while scanning.
[6/13/2021, 7:04:58 PM] [Apple TV Platform] [Apple HB] Error while connecting for heartbeat: Error: Apple TV not found while scanning.
[6/13/2021, 7:05:02 PM] [Apple TV Platform] [Apple HB] Error while connecting: Error: Apple TV not found while scanning.
[6/13/2021, 7:05:09 PM] [Apple TV Platform] [Apple HB] Error while connecting: Error: Apple TV not found while scanning.
Trying to re-pair the device with appletv pair
hangs after sending the initial DEVICE_INFO_MESSAGE
.
Yes, confirmed, can't pair also after tvOS 15 public beta 2. Any possible ideas? Thx @lukasroegner
Did anyone manage to connect successfully? For me it also hangs after sending the initial DEVICE_INFO_MESSAGE. Looks like this project is on the hold and no longer supported. Sad, very useful one.
Same, fails on tvOS 15 beta 2
Confirmed also can't pair tvOS 15 beta 2
@lukasroegner Any news for an update on this?
I've been digging a bit, and it looks like issue is present also in pyatv project which is described here https://github.com/postlund/pyatv/issues/1168 @lukasroegner Something with MRP and Companion
Same here, it's not even possible to detect an Apple TV
I shouldn't have updated loll. Did the update accidentally and the problem occurs. Any news on this?
+1
Same with me Beta3
+1
+1 million but it does not care @lukasroegner
+1 million but it does not care @lukasroegner
I think it is an issue with one of the dependencies. Apple deprecated the old remote api on the Apple TV. Sigh...
I think this plugin is maintained no more, and won't be, as iOS 15 deprecated mechanism that was used previously, so it requires refactoring, as I understood.
Any chance of this working in tvOS15 at some point?
@Willygoat1 Probably. I'm hopeful. Developer postlund has done lots of work with the new Companion protocol and has implemented some Companion remote control functions in the python library pyatv
. Right now controlling the Apple TV using this protocol works with tvOS 14 but not tvOS 15 beta for some reason. It's possible that the beta simply has bugs that prevent it from working with this implementation, or that additional changes will be required to get it to work.
By the looks of it, MRP is going away in tvOS 15. Or that's note entirely true: it is moving. Instead of being its own protocol, it will continue to exist as a special stream type within AirPlay 2. So it's basically possible to setup a channel over AirPlay 2 that carries MRP messages like we do today. It's a bit tricky and I've spent a lot of hours figuring out how that work and started documenting it in the pyatv documentation here. I have not started implementing it in pyatv yet however, that will be the next step and I will probably find a few things to correct in my findings so far. But what's written there is basically what you need to do to get things working again in tvOS 15. Just wanted to let you all know 👍
(Companion can be used for remote control commands, but isn't necessary since MRP can deal with that like before)
Thank you for all your work. 👍
I'm making good progress and I have something ready for testing, in case someone wants to help out. Everything is in this PR:
https://github.com/postlund/pyatv/pull/1263
I just added support for transient pairing, so it works with the HomePod as well.
Nice, but how do I install this? Using Homebridge on Raspberry PI, tried the pip3 install pyatv but command not found error.
Should be possible to run via docker now:
docker run --rm --network=host ghcr.io/postlund/pyatv:master atvremote scan
Hi @postlund
I was able to get the token with docker but when I put it in the plugin I get an error that its not correct. also if I try it with CLI its working and I can get the song details..
Any idea how I can make the plugin work with It?
Thanks.
@naor1 What are you trying more exactly? Some commands and error messages would help a lot.
@postlund
Im trying to connect to the new tvOS 15 with the plugin homebridge-apple-tv-remote. With tvOS 14 im able to connect and control the Apple TV but after updating to 15 I can't, so I tried your suggestion here to get the credentials with docker and I was able to do that but this credentials are not working in the plugin.
I get this error in Homebridge log: "Credentials are invalid. Make sure that you copied them correctly."
This plugin does not support tvOS 15 so that won't work. The credentials you get are only valid for pyatv.
Ahh that make sense.. Thanks.
Is there any support coming for tvOS in the future for this plugin?
@lukasroegner Any news regarding tvOS 15. I just noticed today that there are many errors in the log.
[22.9.2021, 21:25:37] [AppleTvPlatform] [Apple TV] Error while connecting for heartbeat: Error: Apple TV not found while scanning.
[22.9.2021, 21:25:41] [AppleTvPlatform] [Apple TV] Error while connecting: Error: Apple TV not found while scanning.
And of course appletv pair is also not working anymore.
pi@raspberrypi-3BPlus:~ $ appletv pair
⠋ Scanning for Apple TVs...(node:1366) Warning: Accessing non-existent property 'padLevels' of module exports inside circular dependency
(Use `node --trace-warnings ...` to show where the warning was created)
No Apple TVs found on the network. Try again.
I hope you can fix this. Wouldn't want to miss homebridge-apple-tv-remote
Thanks in advance.
Hi @postlund will this plugin work with iOS15 at some point or should we forget about it and find another solution?
@DarKOrange75 I don't know as I don't maintain it. I guess it's up to @lukasroegner if he wants to continue maintain it or if someone else decides to step in and add support for tvOS 15.
@lukasroegner Do you think you can / will fix that?
Do we have someone with the ability and time to resolve this based on the fix by @postlund ? Without looking at this in detail am thinking that the upstream package node-AppleTV-x needs most of the effort.
I made some research and implemented it from scratch (quick fix). Downloaded homebridge-cmd4 plugin and playing with atvremote pyatv
atvremote -s IP_address_of_ATV --airplay-credentials aplay_creds power_state
atvremote -s IP_address_of_ATV --airplay-credentials aplay_creds turn_off
atvremote -s IP_address_of_ATV --airplay-credentials aplay_creds turn_on
homebridge_cmd4:
{ "platform": "Cmd4", "name": "Cmd4", "accessories": [ { "type": "Switch", "name": "TV", "on": false, "state_cmd": "bash appletv.sh", "polling": [ { "on": false, "interval": 5, "timeout": 5000 } ], "interval": 5, "timeout": 5000 } ] }
@shemege Just trying this out where do you put the appletv.sh script?
Is the aplay_creds that long string of characters?
--airplay-credentials aplay_creds
@MatGriffin I put appletv.sh in /home/xxx/.homebridge/ directory (sample script is in homebridge-cmd4 plugin)
And yes aplay_creds is long string (auth to appletv) - generate it:
atvremote -s IP_address_of_ATV --protocol airplay pair
@shemege I got it all working but the ATV comes on, 5 seconds later goes, 5 seconds later goes on.
The individual commands work from the cmd line though.
I now have tvOS 15.1 beta on/off control.
I installed https://pyatv.dev
Once installed I then paired my Apple TV using the command
atvremote -s APPLETVIPADDRESS --protocol companion pair
atvremote -s 192.168.1.100 --protocol companion pair
Enter PIN on screen: 4337
Pairing seems to have succeeded, yey!
You may now use these credentials: ac1c0e52f256dc5f7b47f5f1f4f1e2a40b3c5676f7d598ac686de8b2afc23a54:cba29ca821e92d98ffa8e1eeab5b18a26b2b6a431f5056b452021ee057fa4a6b:43463041354438422d384242362<SNIP>
I copied the long string of numbers and created 3 shell scripts, adding my IP address of the ATV and the long string of numbers to each
appletv_on.sh
atvremote -s 192.168.1.100 --airplay-credentials ac1c0e52f256dc5f7b47f5f1f4f1e2a40b3c5676f7d598ac686de8b2afc23a54:cba29ca821e92d98ffa8e1eeab5b18a26b2b6a431f5056b452021ee057fa4a6b:43463041354438422d384242362<SNIP> turn_on
appletv_off.sh
atvremote -s 192.168.1.100 --airplay-credentials ac1c0e52f256dc5f7b47f5f1f4f1e2a40b3c5676f7d598ac686de8b2afc23a54:cba29ca821e92d98ffa8e1eeab5b18a26b2b6a431f5056b452021ee057fa4a6b:43463041354438422d384242362<SNIP> turn_off
appletv_state.sh
atvremote -s 192.168.1.100 --airplay-credentials ac1c0e52f256dc5f7b47f5f1f4f1e2a40b3c5676f7d598ac686de8b2afc23a54:cba29ca821e92d98ffa8e1eeab5b18a26b2b6a431f5056b452021ee057fa4a6b:43463041354438422d384242362<SNIP> power_state
I copied those on to my raspberry pi at /var/lib/homebridge
I then installed homebridge-script2-ventrilo Homebridge plugin which is a simple plugin that can run the scripts and added the following config:
{
"accessory": "Script2",
"name": "ATV",
"on": "/var/lib/homebridge/appletv_on.sh",
"off": "/var/lib/homebridge/appletv_off.sh",
"state": "/var/lib/homebridge/appletv_state.sh",
"fileState": "/var/lib/homebridge/script1.flag",
"on_value": "true"
}
In Home app I can now turn on and off the ATV :) As I run the Alexa Homebridge plugin I told Alexa to discover devices, ATV was found and I added this to a routine "Watch Apple TV" which turns on the TV, AV Amp, switches HDMI input and now powers on the AppleTV :)
I now have tvOS 15.1 beta on/off control.
I installed https://pyatv.dev Once installed I then paired my Apple TV using the command
atvremote -s APPLETVIPADDRESS --protocol companion pair
atvremote -s 192.168.1.100 --protocol companion pair Enter PIN on screen: 4337 Pairing seems to have succeeded, yey! You may now use these credentials: ac1c0e52f256dc5f7b47f5f1f4f1e2a40b3c5676f7d598ac686de8b2afc23a54:cba29ca821e92d98ffa8e1eeab5b18a26b2b6a431f5056b452021ee057fa4a6b:43463041354438422d384242362<SNIP>
I copied the long string of numbers and created 3 shell scripts, adding my IP address of the ATV and the long string of numbers to each
appletv_on.sh
atvremote -s 192.168.1.100 --airplay-credentials ac1c0e52f256dc5f7b47f5f1f4f1e2a40b3c5676f7d598ac686de8b2afc23a54:cba29ca821e92d98ffa8e1eeab5b18a26b2b6a431f5056b452021ee057fa4a6b:43463041354438422d384242362<SNIP> turn_on
appletv_off.sh
atvremote -s 192.168.1.100 --airplay-credentials ac1c0e52f256dc5f7b47f5f1f4f1e2a40b3c5676f7d598ac686de8b2afc23a54:cba29ca821e92d98ffa8e1eeab5b18a26b2b6a431f5056b452021ee057fa4a6b:43463041354438422d384242362<SNIP> turn_off
appletv_state.sh
atvremote -s 192.168.1.100 --airplay-credentials ac1c0e52f256dc5f7b47f5f1f4f1e2a40b3c5676f7d598ac686de8b2afc23a54:cba29ca821e92d98ffa8e1eeab5b18a26b2b6a431f5056b452021ee057fa4a6b:43463041354438422d384242362<SNIP> power_state
I copied those on to my raspberry pi at
/var/lib/homebridge
I then installed homebridge-script2-ventrilo Homebridge plugin which is a simple plugin that can run the scripts and added the following config:
{ "accessory": "Script2", "name": "ATV", "on": "/var/lib/homebridge/appletv_on.sh", "off": "/var/lib/homebridge/appletv_off.sh", "state": "/var/lib/homebridge/appletv_state.sh", "fileState": "/var/lib/homebridge/script1.flag", "on_value": "true" }
In Home app I can now turn on and off the ATV :) As I run the Alexa Homebridge plugin I told Alexa to discover devices, ATV was found and I added this to a routine "Watch Apple TV" which turns on the TV, AV Amp, switches HDMI input and now powers on the AppleTV :)
I followed your guidelines and did the exact same steps as you but I ended up with a button in the Home app that does nothing... it seems that the scripts are not executed or something else is going wrong.
I now have tvOS 15.1 beta on/off control. I installed https://pyatv.dev Once installed I then paired my Apple TV using the command
atvremote -s APPLETVIPADDRESS --protocol companion pair
atvremote -s 192.168.1.100 --protocol companion pair Enter PIN on screen: 4337 Pairing seems to have succeeded, yey! You may now use these credentials: ac1c0e52f256dc5f7b47f5f1f4f1e2a40b3c5676f7d598ac686de8b2afc23a54:cba29ca821e92d98ffa8e1eeab5b18a26b2b6a431f5056b452021ee057fa4a6b:43463041354438422d384242362<SNIP>
I copied the long string of numbers and created 3 shell scripts, adding my IP address of the ATV and the long string of numbers to each appletv_on.sh
atvremote -s 192.168.1.100 --airplay-credentials ac1c0e52f256dc5f7b47f5f1f4f1e2a40b3c5676f7d598ac686de8b2afc23a54:cba29ca821e92d98ffa8e1eeab5b18a26b2b6a431f5056b452021ee057fa4a6b:43463041354438422d384242362<SNIP> turn_on
appletv_off.shatvremote -s 192.168.1.100 --airplay-credentials ac1c0e52f256dc5f7b47f5f1f4f1e2a40b3c5676f7d598ac686de8b2afc23a54:cba29ca821e92d98ffa8e1eeab5b18a26b2b6a431f5056b452021ee057fa4a6b:43463041354438422d384242362<SNIP> turn_off
appletv_state.shatvremote -s 192.168.1.100 --airplay-credentials ac1c0e52f256dc5f7b47f5f1f4f1e2a40b3c5676f7d598ac686de8b2afc23a54:cba29ca821e92d98ffa8e1eeab5b18a26b2b6a431f5056b452021ee057fa4a6b:43463041354438422d384242362<SNIP> power_state
I copied those on to my raspberry pi at/var/lib/homebridge
I then installed homebridge-script2-ventrilo Homebridge plugin which is a simple plugin that can run the scripts and added the following config:{ "accessory": "Script2", "name": "ATV", "on": "/var/lib/homebridge/appletv_on.sh", "off": "/var/lib/homebridge/appletv_off.sh", "state": "/var/lib/homebridge/appletv_state.sh", "fileState": "/var/lib/homebridge/script1.flag", "on_value": "true" }
In Home app I can now turn on and off the ATV :) As I run the Alexa Homebridge plugin I told Alexa to discover devices, ATV was found and I added this to a routine "Watch Apple TV" which turns on the TV, AV Amp, switches HDMI input and now powers on the AppleTV :)
I followed your guidelines and did the exact same steps as you but I ended up with a button in the Home app that does nothing... it seems that the scripts are not executed or something else is going wrong.
Trying using the full path for atvremote (in my case /home/pi/.local/bin/atvremote), for me that did the trick.
@DarKOrange75 Try using full path and make your scripts executable chmod +x script.sh
@seidnerj and @shemege I changed to the full path like you recommended but this did not fix the issue, the scripts are working fine manually but the homebridge plugin seems to have an issue..
.
@seidnerj and @shemege I changed to the full path like you recommended but this did not fix the issue, the scripts are working fine manually but the homebridge plugin seems to have an issue..
.
Try outputting stdout and stderr to some log file inside the script and see if it even executes, you'll just have to debug it seems unfortunately.
@seidnerj The output shows a permission issue :
/var/lib/homebridge/appletv_on.sh: 1: /var/lib/homebridge/appletv_on.sh: /home/pi/.local/bin/atvremote: Permission denied
@DarKOrange75 try chmod +x /home/pi/.local/bin/atvremote
. What's output command ls -lah /home/pi/.local/bin/
. I mean who is owner of atvremote and it's permission?
I also have a problem, the script works through SSH commands, but the device does not work through the homebridge plugin.
@DarKOrange75 try
chmod +x /home/pi/.local/bin/atvremote
. What's output commandls -lah /home/pi/.local/bin/
. I mean who is owner of atvremote and it's permission?
The owner is pi
@DarKOrange75 @matcik890 Simply try chmod 777 atvremote
or sudo chmod 777 atvremote
It's definitely permission issue. One has owner pi, and another has owner homebridge. I don't use it on raspberry, I'm on virtual enviroment on Ubuntu server.
@DarKOrange75 @matcik890 Просто попробуйте
chmod 777 atvremote
, илиsudo chmod 777 atvremote
это определенно проблема с разрешением. У одного есть владелец pi, а у другого-владелец домашнего моста. Я не использую его на raspberry, я нахожусь в виртуальной среде на сервере Ubuntu. I just gave full access to all files that are related to the work of this plugin, but it didn't work(
I know it's a beta, just wanted to give a heads up that this doesn't work in tvOS 15