Binding for Apple-TV

My problem was running “atvremote --address 10.0.0.157 --login_id ***************** top_menu” from the commandline - aka. native pyatv, that failed - I dont know if running atvremote through the binding will use the added paths(?)

In general, all my problems was python/OS related, not the binding itself…

that’s good new, because preparing the runtime setup is a little bit trick. So far the binding brings it’s own jpy module for various platforms, because it seems that OH uses them internally and it is not allowed to load the binary twice. So by having them with different names in a different path allows me using a private copy. However that’s a little bit stupid to have them installed twice.

Yes, the binding adds those load paths before starting Python, so it’s not the same when you run Python from the command line. AFAIK is there also a environment variable you can set to additional path for applications running from command line (can’t remember the name of the var)

Please always make sure to explicitly run python3.5 command. Otherwise you depend on the default Python version when using the python command without specifying the version. Same with pip: use pip3.5 instead of pip command.

Did you tried sending commands with the binding. This should work if you have the correct id in the binding configuration.

Please note: The alpha release creates a new folder with new copies of the modules each time you restart OH. This is one of the first things I go to fix with the next release (not sure if I have time to work on the binding before end of April).

fyi: I’m making progress

new features:

  • you could send more than one command, e.g. “top_menu right right”
  • automatic device discovery!

Now I try to capture the events and redirect them to the binding, but this will be a challenge

1 Like

More progress, I’m getting the status information - like event, but I need to poll them.

1 Like

Nice work!
Very happy to see this progress.

ok, here is beta 1:
https://raw.github.com/markus7017/org.openhab.binding.appletv/blob/beta1/target/org.openhab.binding.appletv-2.5.0-SNAPSHOT.jar

  • Automatic device discovery (background and from the Inbox)
  • Support for multiple Apple TVs (needs verification)
  • Periodic play status updates
  • Set position, shuffle and repeat mode
  • Relative positions (+10, -10, -30:00 etc.)
  • Special Keys movie,music,tvshows will be mapped to key sequences to select the media category from the main menu
  • Media type decoding in the embedded pyatv fixed (not with atvremote)
  • Prepared for binding configuration and pairing, but not yet implemented.
  • README updated
    and more.

Could someone please check if installed on 2.4 you still have the item in Paper UI’s Control section? Works fine with my 2.5 dev setup, but doesn’t shows up on my 2.4 prod setup.

Important: Existing things have to be deleted. You should shutdown openHAB before updating the jar, maybe you need to clear the cache.

Check out the README for details.

@JohnnyBravo @Normann_P_Nielsen @jacksteraz @Jorn_Reimerdes @crxporter @ei_Gelb_Geek @Heiko_Fanieng @HFM @Rickytr @ciscomike Feedback welcome.

2 Likes

Hi Markus
i am getting 404 error for this page

Strange, it works for me. You could also download the jar from

Both links give me 404:

https://github.com/markus7017/org.openhab.binding.appletv/tree/beta1/target
https://raw.github.com/markus7017/org.openhab.binding.appletv/blob/beta1/target/org.openhab.binding.appletv-2.5.0-SNAPSHOT.jar

try:
https://github.com/markus7017/org.openhab.binding.appletv/raw/master/target/org.openhab.binding.appletv-2.5.0-SNAPSHOT.jar

has anyone already installed the binding on 2.4?

Yes. I installed it on my RP3 with 2.4.

I was able get it set up on my gen 3 ATV. I was able to get artist and song information while playing some music. It doesn’t automatically fetch the album art, but I think that might be in a future release.

I hope to have more time later this week to test it out and to set it up on my ATV4.

I initially had trouble downloading the file. I changed the first part of the url from raw.github.com to gibhub.com and it worked. I suspect it has something to do with either my Windows 8 OS or the chrome browser, because on my ipad, it looked like it was available to download the original link.

When I cleared my cache, I lost access to paper UI. But I found a post in the forums to fix this.

Thanks, got it!

I have the 2.5 binding on OH2.4 - works ok it seems (have only glanced). I see some play info:

Apple TV 4


yes, album art is on the list. However the ay pyATV works is

  • connect to the ATV
  • fetch status and extract the url
  • close connection to ATV

Copy&paste the retrieved into the browser doesn’t work. It has a session id, so I assume that it’s only valid with that session. I need to dig into that some more, but first want to integrate pairing.

good to hear

Some wierdness, for the last 2 days my bedroom TV as been turned on by the ATV several times (until I take the big swich). Started after upgrading… it does not happen at daytime, but starts around 22/23 at night…

hmm, that‘s strange. do you have a standby time? maybe the background poll wakes it up, which powers hdmi and switches on the TV. Do you see anything in the log at that time?

Nothing this night… Maybe Apple is messing with me or some updates…

ok, make sure to have DEBUG enabled (it if doesn’t mess up your log also TRACE is welcome), so we could see if there is some indication of binding activity beside status polls