Binding for Apple-TV

Thank you for providing this.
I have installed your pyatv in its own environment, paired the 3 protocols (and saved the credentials for later use). Also dropped the 4.0.1 binding in the addons folder.
I modified your instructions for my 4.1.0 installation:

AppleTV
OH_HOME=/var/lib/openhab
sudo chmod 777 /var/lib/openhab/tmp
python3 -m venv $OH_HOME/tmp/appletv-binding
source $OH_HOME/tmp/appletv-binding/bin/activate
pip3 install git+https://git.sr.ht/~hww3/pyatv

Addon:
/usr/share/openhab/addons

All well so far.
As expected, just dropping the binding jar in there produced this error:

2023-12-29 19:10:57.714 [INFO ] [enhab.binding.appletv.internal.PyATV] - Sending command scan to deviceId , lid org.openhab.binding.appletv.internal.AppleTVThingConfiguration@5c9adfbc
2023-12-29 19:10:57.727 [WARN ] [enhab.binding.appletv.internal.PyATV] - Failed to execute commandLine '[atvscript, scan]'
2023-12-29 19:10:57.728 [ERROR] [enhab.binding.appletv.internal.PyATV] - Exception on PyATV call: Error executing [atvscript, scan] (class java.lang.RuntimeException)

I clearly need to start the pyatv environment prior to starting openhab, but I’m a bit uncertain exactly how to do this using systemctl?

omr@shs2:~$ sudo systemctl openhab status
Unknown command verb openhab.
omr@shs2:~$ sudo systemctl status openhab
● openhab.service - openHAB - empowering the smart home
     Loaded: loaded (/lib/systemd/system/openhab.service; enabled; vendor preset: enabled)
     Active: active (running) since Fri 2023-12-29 11:34:10 CET; 8h ago
       Docs: https://www.openhab.org/docs/
             https://community.openhab.org
   Main PID: 1538 (java)
      Tasks: 350 (limit: 4448)
     Memory: 1.2G
        CPU: 32min 2.261s
     CGroup: /system.slice/openhab.service
             └─1538 /usr/bin/java -XX:-UsePerfData -Dopenhab.home=/usr/share/openhab -Dopenhab.conf=/etc/openhab -Dopenhab.runtime=/usr/share/openhab/runtime -Dopenhab.userdata=/var/lib/openhab -Dopenhab.logdir=/var/log/openhab -Dfelix.cm.dir=/var/lib/openhab/config -Djava.>

Dec 29 11:34:10 shs2 systemd[1]: Started openHAB - empowering the smart home.
Dec 29 11:36:25 shs2 karaf[1538]: SLF4J: No SLF4J providers were found.
Dec 29 11:36:25 shs2 karaf[1538]: SLF4J: Defaulting to no-operation (NOP) logger implementation
Dec 29 11:36:25 shs2 karaf[1538]: SLF4J: See http://www.slf4j.org/codes.html#noProviders for further details.
Dec 29 11:36:40 shs2 karaf[1538]: Exception in thread "ZWaveReceiveProcessorThread" java.lang.NullPointerException: Cannot read the array length because "message" is null
Dec 29 11:36:40 shs2 karaf[1538]:         at org.openhab.binding.zwave.internal.protocol.ZWaveTransactionManager$ZWaveReceiveThread.run(ZWaveTransactionManager.java:796)

Any suggestions?

Hi-

I actually ran into this exact problem yesterday. I think it’s because the directory containing atvscript and its friends is not in the PATH. I modified the binding so that it always tries to access these under OPENHAB_USERDATA. That environment variable should be set by the openhab startup scripts. I’m running from a direct download of openhab, so that is /opt/openhab4/userdata/tmp/appletv-binding/bin,
but I know it to be different if you’re running openhabian or a package install.

You can download the updated version from the same link above and drop it into your adding directory. OpenHAB should notice the change almost immediately.

This new version will print the path it’s expecting to find the script, so you should be able to move things around, if necessary. For example:

2023-12-29 19:07:19.402 [INFO ] [nding.appletv.internal.PyATV$Scanner] - AppleTVCommandLoop: Running /opt/openhab4/userdata/tmp/appletv-binding/bin/atvscript -i D4909CE4053A command_loop

You shouldn’t have to adjust anything other than making sure the location your atvremote script is the same as what the binding expects. Try installing the new version of the binding and see if it’s trying to run the command from the correct location.

Let me know if that resolves the problem for you and I’ll make sure the documentation is corrected, if necessary!

Bill

Great, but how do I activate the python environment?
Or will the atv scripts run without?

The binding should include the necessary environment variables to make the virtual environment work, so as long as it can find the script, it should run properly (at least it does for me here).

Wow!
Only thing I needed to do was copy over the new binding .jar and the scan went fine.
Pasted in my 3 protocol credentials and it came online … :slight_smile:

Just 2 things I noticed:
1- on my Apple TV 4k 3rd Gen iOS 17.2, the only option for the remote was to Forget this remote.
(Also the remote section is not under General anymore)
I haven’t tried controlling it yet. My primary use will be to automate using Play Mode.

2- this log entry should be DEBUG?

Thank you so much for this!
I migrated from Kodi to ATV during the last weeks and have missed the automatic muting av my kitchen Squeezeboxes when starting TV watching …

Also kind of talkative in idle/OFF state:

2023-12-30 01:48:42.896 [INFO ] [nding.appletv.internal.PyATV$Scanner] - AppleTVCommandLoop: response handler returned false.
2023-12-30 01:48:42.897 [INFO ] [nding.appletv.internal.PyATV$Scanner] - AppleTVCommandLoop: Command process=596842 exited.
2023-12-30 01:48:42.897 [INFO ] [nding.appletv.internal.PyATV$Scanner] - Process 596842 exists.
2023-12-30 01:48:42.897 [INFO ] [nding.appletv.internal.PyATV$Scanner] - destroying process 596842 forcibly.
2023-12-30 01:48:42.900 [WARN ] [nding.appletv.internal.PyATV$Scanner] - PATH: /var/lib/openhab/tmp/appletv-binding/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin
2023-12-30 01:48:42.901 [INFO ] [nding.appletv.internal.PyATV$Scanner] - Started process 597420
2023-12-30 01:48:42.901 [INFO ] [nding.appletv.internal.PyATV$Scanner] - Process 597420 isRunning=true
2023-12-30 01:48:42.901 [INFO ] [nding.appletv.internal.PyATV$Scanner] - AppleTVCommandLoop: Running /var/lib/openhab/tmp/appletv-binding/bin/atvscript -i 48E15C67397B --raop-credentials :82f302c6d712ec4e205c5bacd9cb79f3f016a0f9e00089954235696bd7a5c800::35805657597c72d1 --airplay-credentials 56211473591d5de6d426ae0a49cf76b0030b45c8b4bd8c7db97181219ce19302:b1faf619242f1efa09718f3edb5121e2e60cc8ea5de1dfbe5dcb5ef2995aa770:38364633373839392d453045372d344541372d424339452d423337383635423344443546:64323461613333362d653738642d343037612d623838342d626530376162396462613334 --companion-credentials 56211473591d5de6d426ae0a49cf76b0030b45c8b4bd8c7db97181219ce19302:2d848afe96bb95a2e4fe21cf90d6eca12187fbe86ba35810802969b1ca489db4:38364633373839392d453045372d344541372d424339452d423337383635423344443546:61313130373931342d653236662d343733662d396363652d313865303235313539356337 command_loop
2023-12-30 01:49:31.063 [INFO ] [nding.appletv.internal.PyATV$Scanner] - AppleTVEventScanner: Command process=597372 exited.
2023-12-30 01:49:31.063 [INFO ] [nding.appletv.internal.PyATV$Scanner] - Process 597372 exists.
2023-12-30 01:49:31.066 [WARN ] [nding.appletv.internal.PyATV$Scanner] - PATH: /var/lib/openhab/tmp/appletv-binding/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin
2023-12-30 01:49:31.066 [INFO ] [nding.appletv.internal.PyATV$Scanner] - Started process 597967
2023-12-30 01:49:31.067 [INFO ] [nding.appletv.internal.PyATV$Scanner] - Process 597967 isRunning=true
2023-12-30 01:49:31.067 [INFO ] [nding.appletv.internal.PyATV$Scanner] - AppleTVEventScanner: Running /var/lib/openhab/tmp/appletv-binding/bin/atvscript -i 48E15C67397B --raop-credentials :82f302c6d712ec4e205c5bacd9cb79f3f016a0f9e00089954235696bd7a5c800::35805657597c72d1 --airplay-credentials 56211473591d5de6d426ae0a49cf76b0030b45c8b4bd8c7db97181219ce19302:b1faf619242f1efa09718f3edb5121e2e60cc8ea5de1dfbe5dcb5ef2995aa770:38364633373839392d453045372d344541372d424339452d423337383635423344443546:64323461613333362d653738642d343037612d623838342d626530376162396462613334 --companion-credentials 56211473591d5de6d426ae0a49cf76b0030b45c8b4bd8c7db97181219ce19302:2d848afe96bb95a2e4fe21cf90d6eca12187fbe86ba35810802969b1ca489db4:38364633373839392d453045372d344541372d424339452d423337383635423344443546:61313130373931342d653236662d343733662d396363652d313865303235313539356337 push_updates
2023-12-30 01:49:35.021 [INFO ] [nding.appletv.internal.PyATV$Scanner] - queueing command: artwork
2023-12-30 01:49:35.024 [ERROR] [ding.appletv.internal.AppleTVHandler] - ATV command threw exception: metadata is blocked:
Traceback (most recent call last):
  File "/var/lib/openhab/tmp/appletv-binding/lib/python3.10/site-packages/pyatv/scripts/atvscript.py", line 337, in _run_command
    print(args.output(output_artwork(await atv.metadata.artwork(), atv.metadata.app)),
  File "/var/lib/openhab/tmp/appletv-binding/lib/python3.10/site-packages/pyatv/support/shield.py", line 71, in _guard_method
    raise BlockedStateError(f"{func.__name__} is blocked")
pyatv.exceptions.BlockedStateError: metadata is blocked

2023-12-30 01:49:35.024 [INFO ] [nding.appletv.internal.PyATV$Scanner] - AppleTVCommandLoop: response handler returned false.
2023-12-30 01:49:35.025 [INFO ] [nding.appletv.internal.PyATV$Scanner] - AppleTVCommandLoop: Command process=597420 exited.
2023-12-30 01:49:35.025 [INFO ] [nding.appletv.internal.PyATV$Scanner] - Process 597420 exists.
2023-12-30 01:49:35.025 [INFO ] [nding.appletv.internal.PyATV$Scanner] - destroying process 597420 forcibly.
2023-12-30 01:49:35.029 [WARN ] [nding.appletv.internal.PyATV$Scanner] - PATH: /var/lib/openhab/tmp/appletv-binding/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin
2023-12-30 01:49:35.029 [INFO ] [nding.appletv.internal.PyATV$Scanner] - Started process 598019
2023-12-30 01:49:35.029 [INFO ] [nding.appletv.internal.PyATV$Scanner] - Process 598019 isRunning=true
2023-12-30 01:49:35.029 [INFO ] [nding.appletv.internal.PyATV$Scanner] - AppleTVCommandLoop: Running /var/lib/openhab/tmp/appletv-binding/bin/atvscript -i 48E15C67397B --raop-credentials :82f302c6d712ec4e205c5bacd9cb79f3f016a0f9e00089954235696bd7a5c800::35805657597c72d1 --airplay-credentials 56211473591d5de6d426ae0a49cf76b0030b45c8b4bd8c7db97181219ce19302:b1faf619242f1efa09718f3edb5121e2e60cc8ea5de1dfbe5dcb5ef2995aa770:38364633373839392d453045372d344541372d424339452d423337383635423344443546:64323461613333362d653738642d343037612d623838342d626530376162396462613334 --companion-credentials 56211473591d5de6d426ae0a49cf76b0030b45c8b4bd8c7db97181219ce19302:2d848afe96bb95a2e4fe21cf90d6eca12187fbe86ba35810802969b1ca489db4:38364633373839392d453045372d344541372d424339452d423337383635423344443546:61313130373931342d653236662d343733662d396363652d313865303235313539356337 command_loop

Hi-

Glad it started up for you.

  1. I don’t believe the binding uses a remote spot; it uses the same mechanism as the Apple Remote control app for iOS. You’ll probably need to figure out the correct series of remote presses to have it do what you want; the navigation is all a bit relative to where you happen to be. The application name channel /is/ updatable, so you can also try starting an app by changing the value there.

  2. This is a development build for me, so it’s quite chatty. I hope to remove a lot of that noise once I’m satisfied that it’s working reliably.

Sometimes after having powered down the ATV, Play mode is idle and Power mode off even though it is playing.
Status is Online. Just hitting Pause (Disable) and Play (Enable) makes it update with correct values.

Log from before Disable:

2024-01-04 22:04:44.989 [INFO ] [enhab.binding.appletv.internal.PyATV] - Started process 2265845
2024-01-04 22:04:44.989 [INFO ] [enhab.binding.appletv.internal.PyATV] - Running [/var/lib/openhab/tmp/appletv-binding/bin/atvscript, -i, 48E15C67397B, --raop-credentials, :82f302c6d712ec4e205c5bacd9cb79f3f016a0f9e00089954235696bd7a5c800::35805657597c72d1, --airplay-credentials, 56211473591d5de6d426ae0a49cf76b0030b45c8b4bd8c7db97181219ce19302:b1faf619242f1efa09718f3edb5121e2e60cc8ea5de1dfbe5dcb5ef2995aa770:38364633373839392d453045372d344541372d424339452d423337383635423344443546:64323461613333362d653738642d343037612d623838342d626530376162396462613334, --companion-credentials, 56211473591d5de6d426ae0a49cf76b0030b45c8b4bd8c7db97181219ce19302:2d848afe96bb95a2e4fe21cf90d6eca12187fbe86ba35810802969b1ca489db4:38364633373839392d453045372d344541372d424339452d423337383635423344443546:61313130373931342d653236662d343733662d396363652d313865303235313539356337, all_features]
2024-01-04 22:04:46.084 [INFO ] [ding.appletv.internal.AppleTVHandler] - Features: Features{features=[FeatureInfo{name='Up', state=Available, options={}}, FeatureInfo{name='Down', state=Available, options={}}, FeatureInfo{name='Left', state=Available, options={}}, FeatureInfo{name='Right', state=Available, options={}}, FeatureInfo{name='Play', state=Available, options={}}, FeatureInfo{name='PlayPause', state=Available, options={}}, FeatureInfo{name='Pause', state=Available, options={}}, FeatureInfo{name='Stop', state=Available, options={}}, FeatureInfo{name='Next', state=Unavailable, options={}}, FeatureInfo{name='Previous', state=Unavailable, options={}}, FeatureInfo{name='Select', state=Available, options={}}, FeatureInfo{name='Menu', state=Available, options={}}, FeatureInfo{name='VolumeUp', state=Available, options={}}, FeatureInfo{name='VolumeDown', state=Available, options={}}, FeatureInfo{name='Home', state=Available, options={}}, FeatureInfo{name='HomeHold', state=Available, options={}}, FeatureInfo{name='TopMenu', state=Available, options={}}, FeatureInfo{name='SkipForward', state=Available, options={}}, FeatureInfo{name='SkipBackward', state=Available, options={}}, FeatureInfo{name='SetPosition', state=Available, options={}}, FeatureInfo{name='SetShuffle', state=Unavailable, options={}}, FeatureInfo{name='SetRepeat', state=Unavailable, options={}}, FeatureInfo{name='ChannelUp', state=Available, options={}}, FeatureInfo{name='ChannelDown', state=Available, options={}}, FeatureInfo{name='Title', state=Available, options={}}, FeatureInfo{name='Artist', state=Unavailable, options={}}, FeatureInfo{name='Album', state=Unavailable, options={}}, FeatureInfo{name='Genre', state=Unavailable, options={}}, FeatureInfo{name='TotalTime', state=Unavailable, options={}}, FeatureInfo{name='Position', state=Available, options={}}, FeatureInfo{name='Shuffle', state=Unavailable, options={}}, FeatureInfo{name='Repeat', state=Unavailable, options={}}, FeatureInfo{name='SeriesName', state=Unavailable, options={}}, FeatureInfo{name='SeasonNumber', state=Unavailable, options={}}, FeatureInfo{name='EpisodeNumber', state=Unavailable, options={}}, FeatureInfo{name='ContentIdentifier', state=Unavailable, options={}}, FeatureInfo{name='AppList', state=Available, options={}}, FeatureInfo{name='LaunchApp', state=Available, options={}}, FeatureInfo{name='AccountList', state=Available, options={}}, FeatureInfo{name='SwitchAccount', state=Available, options={}}, FeatureInfo{name='Artwork', state=Available, options={}}, FeatureInfo{name='App', state=Available, options={}}, FeatureInfo{name='PushUpdates', state=Available, options={}}, FeatureInfo{name='PlayUrl', state=Available, options={}}, FeatureInfo{name='StreamFile', state=Available, options={}}, FeatureInfo{name='PowerState', state=Available, options={}}, FeatureInfo{name='TurnOn', state=Available, options={}}, FeatureInfo{name='TurnOff', state=Available, options={}}, FeatureInfo{name='Volume', state=Available, options={}}, FeatureInfo{name='SetVolume', state=Available, options={}}]}
2024-01-04 22:04:46.084 [INFO ] [ding.appletv.internal.AppleTVHandler] - Event Scanner: Scanner{name='AppleTVEventScanner', process=Process[pid=2028430, exitValue="not exited"], isStarted=true, expectedCommandLine='/var/lib/openhab/tmp/appletv-binding/bin/atvscript -i 48E15C67397B --raop-credentials :82f302c6d712ec4e205c5bacd9cb79f3f016a0f9e00089954235696bd7a5c800::35805657597c72d1 --airplay-credentials 56211473591d5de6d426ae0a49cf76b0030b45c8b4bd8c7db97181219ce19302:b1faf619242f1efa09718f3edb5121e2e60cc8ea5de1dfbe5dcb5ef2995aa770:38364633373839392d453045372d344541372d424339452d423337383635423344443546:64323461613333362d653738642d343037612d623838342d626530376162396462613334 --companion-credentials 56211473591d5de6d426ae0a49cf76b0030b45c8b4bd8c7db97181219ce19302:2d848afe96bb95a2e4fe21cf90d6eca12187fbe86ba35810802969b1ca489db4:38364633373839392d453045372d344541372d424339452d423337383635423344443546:61313130373931342d653236662d343733662d396363652d313865303235313539356337 push_updates'}
2024-01-04 22:04:46.084 [INFO ] [ding.appletv.internal.AppleTVHandler] - Command Scanner: Scanner{name='AppleTVCommandLoop', process=Process[pid=2028474, exitValue="not exited"], isStarted=true, expectedCommandLine='/var/lib/openhab/tmp/appletv-binding/bin/atvscript -i 48E15C67397B --raop-credentials :82f302c6d712ec4e205c5bacd9cb79f3f016a0f9e00089954235696bd7a5c800::35805657597c72d1 --airplay-credentials 56211473591d5de6d426ae0a49cf76b0030b45c8b4bd8c7db97181219ce19302:b1faf619242f1efa09718f3edb5121e2e60cc8ea5de1dfbe5dcb5ef2995aa770:38364633373839392d453045372d344541372d424339452d423337383635423344443546:64323461613333362d653738642d343037612d623838342d626530376162396462613334 --companion-credentials 56211473591d5de6d426ae0a49cf76b0030b45c8b4bd8c7db97181219ce19302:2d848afe96bb95a2e4fe21cf90d6eca12187fbe86ba35810802969b1ca489db4:38364633373839392d453045372d344541372d424339452d423337383635423344443546:61313130373931342d653236662d343733662d396363652d313865303235313539356337 command_loop'}
2024-01-04 22:05:59.968 [INFO ] [org.openhab.core.model.script.Fan   ] - Fan OFF
2024-01-04 22:07:43.723 [INFO ] [org.openhab.core.model.script.motion] - StairsMovement State=OFF
2024-01-04 22:07:43.724 [INFO ] [org.openhab.core.model.script.Motion] - StairsMovement.state=OFF
2024-01-04 22:09:46.084 [WARN ] [enhab.binding.appletv.internal.PyATV] - PaTH: /var/lib/openhab/tmp/appletv-binding/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin
2024-01-04 22:09:46.089 [INFO ] [enhab.binding.appletv.internal.PyATV] - Started process 2269269
2024-01-04 22:09:46.090 [INFO ] [enhab.binding.appletv.internal.PyATV] - Running [/var/lib/openhab/tmp/appletv-binding/bin/atvremote, -i, 48E15C67397B, --raop-credentials, :82f302c6d712ec4e205c5bacd9cb79f3f016a0f9e00089954235696bd7a5c800::35805657597c72d1, --airplay-credentials, 56211473591d5de6d426ae0a49cf76b0030b45c8b4bd8c7db97181219ce19302:b1faf619242f1efa09718f3edb5121e2e60cc8ea5de1dfbe5dcb5ef2995aa770:38364633373839392d453045372d344541372d424339452d423337383635423344443546:64323461613333362d653738642d343037612d623838342d626530376162396462613334, --companion-credentials, 56211473591d5de6d426ae0a49cf76b0030b45c8b4bd8c7db97181219ce19302:2d848afe96bb95a2e4fe21cf90d6eca12187fbe86ba35810802969b1ca489db4:38364633373839392d453045372d344541372d424339452d423337383635423344443546:61313130373931342d653236662d343733662d396363652d313865303235313539356337, mac]
2024-01-04 22:09:47.170 [INFO ] [ding.appletv.internal.AppleTVHandler] - Pairing Verified: 48:E1:5C:67:39:7B

2024-01-04 22:09:47.170 [WARN ] [enhab.binding.appletv.internal.PyATV] - PaTH: /var/lib/openhab/tmp/appletv-binding/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin
2024-01-04 22:09:47.173 [INFO ] [enhab.binding.appletv.internal.PyATV] - Started process 2269299
2024-01-04 22:09:47.173 [INFO ] [enhab.binding.appletv.internal.PyATV] - Running [/var/lib/openhab/tmp/appletv-binding/bin/atvscript, -i, 48E15C67397B, --raop-credentials, :82f302c6d712ec4e205c5bacd9cb79f3f016a0f9e00089954235696bd7a5c800::35805657597c72d1, --airplay-credentials, 56211473591d5de6d426ae0a49cf76b0030b45c8b4bd8c7db97181219ce19302:b1faf619242f1efa09718f3edb5121e2e60cc8ea5de1dfbe5dcb5ef2995aa770:38364633373839392d453045372d344541372d424339452d423337383635423344443546:64323461613333362d653738642d343037612d623838342d626530376162396462613334, --companion-credentials, 56211473591d5de6d426ae0a49cf76b0030b45c8b4bd8c7db97181219ce19302:2d848afe96bb95a2e4fe21cf90d6eca12187fbe86ba35810802969b1ca489db4:38364633373839392d453045372d344541372d424339452d423337383635423344443546:61313130373931342d653236662d343733662d396363652d313865303235313539356337, all_features]
2024-01-04 22:09:48.297 [INFO ] [ding.appletv.internal.AppleTVHandler] - Features: Features{features=[FeatureInfo{name='Up', state=Available, options={}}, FeatureInfo{name='Down', state=Available, options={}}, FeatureInfo{name='Left', state=Available, options={}}, FeatureInfo{name='Right', state=Available, options={}}, FeatureInfo{name='Play', state=Available, options={}}, FeatureInfo{name='PlayPause', state=Available, options={}}, FeatureInfo{name='Pause', state=Available, options={}}, FeatureInfo{name='Stop', state=Available, options={}}, FeatureInfo{name='Next', state=Unavailable, options={}}, FeatureInfo{name='Previous', state=Unavailable, options={}}, FeatureInfo{name='Select', state=Available, options={}}, FeatureInfo{name='Menu', state=Available, options={}}, FeatureInfo{name='VolumeUp', state=Available, options={}}, FeatureInfo{name='VolumeDown', state=Available, options={}}, FeatureInfo{name='Home', state=Available, options={}}, FeatureInfo{name='HomeHold', state=Available, options={}}, FeatureInfo{name='TopMenu', state=Available, options={}}, FeatureInfo{name='SkipForward', state=Available, options={}}, FeatureInfo{name='SkipBackward', state=Available, options={}}, FeatureInfo{name='SetPosition', state=Available, options={}}, FeatureInfo{name='SetShuffle', state=Unavailable, options={}}, FeatureInfo{name='SetRepeat', state=Unavailable, options={}}, FeatureInfo{name='ChannelUp', state=Available, options={}}, FeatureInfo{name='ChannelDown', state=Available, options={}}, FeatureInfo{name='Title', state=Available, options={}}, FeatureInfo{name='Artist', state=Unavailable, options={}}, FeatureInfo{name='Album', state=Unavailable, options={}}, FeatureInfo{name='Genre', state=Unavailable, options={}}, FeatureInfo{name='TotalTime', state=Unavailable, options={}}, FeatureInfo{name='Position', state=Available, options={}}, FeatureInfo{name='Shuffle', state=Unavailable, options={}}, FeatureInfo{name='Repeat', state=Unavailable, options={}}, FeatureInfo{name='SeriesName', state=Unavailable, options={}}, FeatureInfo{name='SeasonNumber', state=Unavailable, options={}}, FeatureInfo{name='EpisodeNumber', state=Unavailable, options={}}, FeatureInfo{name='ContentIdentifier', state=Unavailable, options={}}, FeatureInfo{name='AppList', state=Available, options={}}, FeatureInfo{name='LaunchApp', state=Available, options={}}, FeatureInfo{name='AccountList', state=Available, options={}}, FeatureInfo{name='SwitchAccount', state=Available, options={}}, FeatureInfo{name='Artwork', state=Available, options={}}, FeatureInfo{name='App', state=Available, options={}}, FeatureInfo{name='PushUpdates', state=Available, options={}}, FeatureInfo{name='PlayUrl', state=Available, options={}}, FeatureInfo{name='StreamFile', state=Available, options={}}, FeatureInfo{name='PowerState', state=Available, options={}}, FeatureInfo{name='TurnOn', state=Available, options={}}, FeatureInfo{name='TurnOff', state=Available, options={}}, FeatureInfo{name='Volume', state=Available, options={}}, FeatureInfo{name='SetVolume', state=Available, options={}}]}
2024-01-04 22:09:48.297 [INFO ] [ding.appletv.internal.AppleTVHandler] - Event Scanner: Scanner{name='AppleTVEventScanner', process=Process[pid=2028430, exitValue="not exited"], isStarted=true, expectedCommandLine='/var/lib/openhab/tmp/appletv-binding/bin/atvscript -i 48E15C67397B --raop-credentials :82f302c6d712ec4e205c5bacd9cb79f3f016a0f9e00089954235696bd7a5c800::35805657597c72d1 --airplay-credentials 56211473591d5de6d426ae0a49cf76b0030b45c8b4bd8c7db97181219ce19302:b1faf619242f1efa09718f3edb5121e2e60cc8ea5de1dfbe5dcb5ef2995aa770:38364633373839392d453045372d344541372d424339452d423337383635423344443546:64323461613333362d653738642d343037612d623838342d626530376162396462613334 --companion-credentials 56211473591d5de6d426ae0a49cf76b0030b45c8b4bd8c7db97181219ce19302:2d848afe96bb95a2e4fe21cf90d6eca12187fbe86ba35810802969b1ca489db4:38364633373839392d453045372d344541372d424339452d423337383635423344443546:61313130373931342d653236662d343733662d396363652d313865303235313539356337 push_updates'}
2024-01-04 22:09:48.297 [INFO ] [ding.appletv.internal.AppleTVHandler] - Command Scanner: Scanner{name='AppleTVCommandLoop', process=Process[pid=2028474, exitValue="not exited"], isStarted=true, expectedCommandLine='/var/lib/openhab/tmp/appletv-binding/bin/atvscript -i 48E15C67397B --raop-credentials :82f302c6d712ec4e205c5bacd9cb79f3f016a0f9e00089954235696bd7a5c800::35805657597c72d1 --airplay-credentials 56211473591d5de6d426ae0a49cf76b0030b45c8b4bd8c7db97181219ce19302:b1faf619242f1efa09718f3edb5121e2e60cc8ea5de1dfbe5dcb5ef2995aa770:38364633373839392d453045372d344541372d424339452d423337383635423344443546:64323461613333362d653738642d343037612d623838342d626530376162396462613334 --companion-credentials 56211473591d5de6d426ae0a49cf76b0030b45c8b4bd8c7db97181219ce19302:2d848afe96bb95a2e4fe21cf90d6eca12187fbe86ba35810802969b1ca489db4:38364633373839392d453045372d344541372d424339452d423337383635423344443546:61313130373931342d653236662d343733662d396363652d313865303235313539356337 command_loop'}
2024-01-04 22:10:00.920 [INFO ] [ding.appletv.internal.AppleTVHandler] - Starting Apple-TV discovery
2024-01-04 22:10:00.920 [INFO ] [enhab.binding.appletv.internal.PyATV] - Scan for AppleTV devices
2024-01-04 22:10:00.921 [INFO ] [enhab.binding.appletv.internal.PyATV] - Sending command scan to deviceId , lid org.openhab.binding.appletv.internal.AppleTVThingConfiguration@21b0a0d
2024-01-04 22:10:00.921 [WARN ] [enhab.binding.appletv.internal.PyATV] - PaTH: /var/lib/openhab/tmp/appletv-binding/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin
2024-01-04 22:10:00.926 [INFO ] [enhab.binding.appletv.internal.PyATV] - Started process 2269450
2024-01-04 22:10:00.927 [INFO ] [enhab.binding.appletv.internal.PyATV] - Running [/var/lib/openhab/tmp/appletv-binding/bin/atvscript, scan]
2024-01-04 22:10:06.857 [INFO ] [ding.appletv.internal.AppleTVHandler] - Device Denon AVC-X4700H discovered: ipAddress=192.168.1.246, deviceId=00:06:78:6C:CC:0A, loginId=[Service{protocol='airplay', port=7000, password=false, pairing=NotNeeded, enabled=true}, Service{protocol='raop', port=7000, password=false, pairing=NotNeeded, enabled=true}], services={}
2024-01-04 22:10:06.857 [INFO ] [ding.appletv.internal.AppleTVHandler] - DeviceInfo: ATVDevice{identifier='00:06:78:6C:CC:0A', name='Denon AVC-X4700H', address='192.168.1.246', services=[Service{protocol='airplay', port=7000, password=false, pairing=NotNeeded, enabled=true}, Service{protocol='raop', port=7000, password=false, pairing=NotNeeded, enabled=true}], deviceInfo=DeviceInfo{model='Unknown', operatingSystem='Unknown', version='null', buildNumber='null', mac='00:06:78:6C:CC:0A'}}
2024-01-04 22:10:06.857 [INFO ] [ding.appletv.internal.AppleTVHandler] - Properties: {macAddress=00:06:78:6C:CC:0A, loginId=Denon AVC-X4700H, modelId=Unknown, vendor=Apple, pairingRaop=NotNeeded, ipAddress=192.168.1.246, pairingAirplay=NotNeeded, firmwareVersion=Unknown null, deviceId=00:06:78:6C:CC:0A}
2024-01-04 22:10:06.858 [INFO ] [ding.appletv.internal.AppleTVHandler] - Device Samsung Q90 Series (75) discovered: ipAddress=192.168.1.208, deviceId=D0:D0:03:09:5B:BE, loginId=[Service{protocol='airplay', port=56426, password=false, pairing=Mandatory, enabled=true}], services={}
2024-01-04 22:10:06.858 [INFO ] [ding.appletv.internal.AppleTVHandler] - DeviceInfo: ATVDevice{identifier='D0:D0:03:09:5B:BE', name='Samsung Q90 Series (75)', address='192.168.1.208', services=[Service{protocol='airplay', port=56426, password=false, pairing=Mandatory, enabled=true}], deviceInfo=DeviceInfo{model='Unknown', operatingSystem='Unknown', version='null', buildNumber='null', mac='D0:D0:03:09:5B:BE'}}
2024-01-04 22:10:06.858 [INFO ] [ding.appletv.internal.AppleTVHandler] - Properties: {macAddress=D0:D0:03:09:5B:BE, loginId=Samsung Q90 Series (75), modelId=Unknown, vendor=Apple, ipAddress=192.168.1.208, pairingAirplay=Mandatory, firmwareVersion=Unknown null, deviceId=D0:D0:03:09:5B:BE}
2024-01-04 22:10:06.862 [INFO ] [ding.appletv.internal.AppleTVHandler] - Device Living Room discovered: ipAddress=192.168.1.119, deviceId=48:E1:5C:67:39:7B, loginId=[Service{protocol='companion', port=49153, password=false, pairing=Mandatory, enabled=true}, Service{protocol='airplay', port=7000, password=false, pairing=Mandatory, enabled=true}, Service{protocol='raop', port=7000, password=false, pairing=Mandatory, enabled=true}], services={}
2024-01-04 22:10:06.862 [INFO ] [ding.appletv.internal.AppleTVHandler] - DeviceInfo: ATVDevice{identifier='48:E1:5C:67:39:7B', name='Living Room', address='192.168.1.119', services=[Service{protocol='companion', port=49153, password=false, pairing=Mandatory, enabled=true}, Service{protocol='airplay', port=7000, password=false, pairing=Mandatory, enabled=true}, Service{protocol='raop', port=7000, password=false, pairing=Mandatory, enabled=true}], deviceInfo=DeviceInfo{model='Unknown', operatingSystem='Unknown', version='17.2', buildNumber='null', mac='48:E1:5C:67:39:7B'}}
2024-01-04 22:10:06.862 [INFO ] [ding.appletv.internal.AppleTVHandler] - Properties: {macAddress=48:E1:5C:67:39:7B, loginId=Living Room, modelId=Unknown, vendor=Apple, pairingRaop=Mandatory, ipAddress=192.168.1.119, pairingAirplay=Mandatory, pairingCompanion=Mandatory, firmwareVersion=Unknown 17.2, deviceId=48:E1:5C:67:39:7B}
2024-01-04 22:10:06.864 [INFO ] [ding.appletv.internal.AppleTVHandler] - Apple-TV discovery completed
2024-01-04 22:11:23.026 [INFO ] [org.openhab.core.model.script.Motion] - BathMovement.state=OFF

Log from Enable:

2024-01-04 22:18:52.546 [INFO ] [ding.appletv.internal.AppleTVHandler] - Disposing of AppleTVHandler
2024-01-04 22:18:52.547 [INFO ] [nding.appletv.internal.PyATV$Scanner] - AppleTVEventScanner: stop()
2024-01-04 22:18:52.547 [INFO ] [nding.appletv.internal.PyATV$Scanner] - AppleTVEventScanner: Sending exit command to scanner process.
2024-01-04 22:18:52.547 [INFO ] [nding.appletv.internal.PyATV$Scanner] - AppleTVEventScanner: Attempt to read command queue was interrupted.
2024-01-04 22:18:52.548 [INFO ] [nding.appletv.internal.PyATV$Scanner] - AppleTVEventScanner: exiting command poller
2024-01-04 22:18:52.548 [INFO ] [nding.appletv.internal.PyATV$Scanner] - AppleTVEventScanner: Commander pid=2028430 exited.
2024-01-04 22:18:52.549 [INFO ] [nding.appletv.internal.PyATV$Scanner] - AppleTVEventScanner: Commander KeepRunning is false, so returning.
2024-01-04 22:18:52.594 [INFO ] [nding.appletv.internal.PyATV$Scanner] - AppleTVEventScanner: Command process=2028430 exited.
2024-01-04 22:18:52.594 [INFO ] [nding.appletv.internal.PyATV$Scanner] - Process 2028430 exists.
2024-01-04 22:18:52.594 [INFO ] [nding.appletv.internal.PyATV$Scanner] - destroying process 2028430 forcibly.
2024-01-04 22:18:52.595 [INFO ] [nding.appletv.internal.PyATV$Scanner] - returning because !keepRunning
2024-01-04 22:18:52.597 [INFO ] [nding.appletv.internal.PyATV$Scanner] - AppleTVCommandLoop: stop()
2024-01-04 22:18:52.598 [INFO ] [nding.appletv.internal.PyATV$Scanner] - AppleTVCommandLoop: Sending exit command to scanner process.
2024-01-04 22:18:52.598 [INFO ] [nding.appletv.internal.PyATV$Scanner] - AppleTVCommandLoop: Attempt to read command queue was interrupted.
2024-01-04 22:18:52.600 [INFO ] [nding.appletv.internal.PyATV$Scanner] - AppleTVCommandLoop: exiting command poller
2024-01-04 22:18:52.601 [INFO ] [nding.appletv.internal.PyATV$Scanner] - AppleTVCommandLoop: Commander pid=2028474 exited.
2024-01-04 22:18:52.601 [INFO ] [nding.appletv.internal.PyATV$Scanner] - AppleTVCommandLoop: Commander KeepRunning is false, so returning.
2024-01-04 22:18:52.646 [INFO ] [nding.appletv.internal.PyATV$Scanner] - AppleTVCommandLoop: Command process=2028474 exited.
2024-01-04 22:18:52.647 [INFO ] [nding.appletv.internal.PyATV$Scanner] - Process 2028474 exists.
2024-01-04 22:18:52.647 [INFO ] [nding.appletv.internal.PyATV$Scanner] - destroying process 2028474 forcibly.
2024-01-04 22:18:52.647 [INFO ] [nding.appletv.internal.PyATV$Scanner] - returning because !keepRunning
2024-01-04 22:18:54.515 [INFO ] [pletv.internal.AppleTVHandlerFactory] - Calling createHandler: org.openhab.core.thing.internal.ThingImpl@b18981f0
2024-01-04 22:18:54.516 [INFO ] [pletv.internal.AppleTVHandlerFactory] - Creating a thing handler
2024-01-04 22:18:54.522 [INFO ] [ding.appletv.internal.AppleTVHandler] - AppleTV Properties: {macAddress=48:E1:5C:67:39:7B, modelId=Unknown, vendor=Apple, pairingRaop=Mandatory, pairingAirplay=Mandatory, pairingCompanion=Mandatory, firmwareVersion=Unknown 17.2, deviceId=48:E1:5C:67:39:7B}
2024-01-04 22:18:54.525 [INFO ] [ding.appletv.internal.AppleTVHandler] - Initializing AppleTV
2024-01-04 22:18:54.529 [INFO ] [ding.appletv.internal.AppleTVHandler] - Pairing Requirement for Airplay: Mandatory
2024-01-04 22:18:54.530 [INFO ] [ding.appletv.internal.AppleTVHandler] - Pairing Requirement for Companion: Mandatory
2024-01-04 22:18:54.530 [INFO ] [ding.appletv.internal.AppleTVHandler] - Pairing Requirement for MRP: Disabled
2024-01-04 22:18:54.530 [INFO ] [ding.appletv.internal.AppleTVHandler] - Pairing Requirement for RAOP: Mandatory
2024-01-04 22:18:54.531 [WARN ] [enhab.binding.appletv.internal.PyATV] - PaTH: /var/lib/openhab/tmp/appletv-binding/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin
2024-01-04 22:18:54.534 [INFO ] [enhab.binding.appletv.internal.PyATV] - Started process 2276139
2024-01-04 22:18:54.535 [INFO ] [enhab.binding.appletv.internal.PyATV] - Running [/var/lib/openhab/tmp/appletv-binding/bin/atvremote, -i, 48E15C67397B, --raop-credentials, :82f302c6d712ec4e205c5bacd9cb79f3f016a0f9e00089954235696bd7a5c800::35805657597c72d1, --airplay-credentials, 56211473591d5de6d426ae0a49cf76b0030b45c8b4bd8c7db97181219ce19302:b1faf619242f1efa09718f3edb5121e2e60cc8ea5de1dfbe5dcb5ef2995aa770:38364633373839392d453045372d344541372d424339452d423337383635423344443546:64323461613333362d653738642d343037612d623838342d626530376162396462613334, --companion-credentials, 56211473591d5de6d426ae0a49cf76b0030b45c8b4bd8c7db97181219ce19302:2d848afe96bb95a2e4fe21cf90d6eca12187fbe86ba35810802969b1ca489db4:38364633373839392d453045372d344541372d424339452d423337383635423344443546:61313130373931342d653236662d343733662d396363652d313865303235313539356337, mac]
2024-01-04 22:18:55.604 [INFO ] [ding.appletv.internal.AppleTVHandler] - Pairing Verified: 48:E1:5C:67:39:7B

2024-01-04 22:18:55.605 [WARN ] [enhab.binding.appletv.internal.PyATV] - PaTH: /var/lib/openhab/tmp/appletv-binding/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin
2024-01-04 22:18:55.608 [INFO ] [enhab.binding.appletv.internal.PyATV] - Started process 2276152
2024-01-04 22:18:55.609 [INFO ] [enhab.binding.appletv.internal.PyATV] - Running [/var/lib/openhab/tmp/appletv-binding/bin/atvscript, -i, 48E15C67397B, --raop-credentials, :82f302c6d712ec4e205c5bacd9cb79f3f016a0f9e00089954235696bd7a5c800::35805657597c72d1, --airplay-credentials, 56211473591d5de6d426ae0a49cf76b0030b45c8b4bd8c7db97181219ce19302:b1faf619242f1efa09718f3edb5121e2e60cc8ea5de1dfbe5dcb5ef2995aa770:38364633373839392d453045372d344541372d424339452d423337383635423344443546:64323461613333362d653738642d343037612d623838342d626530376162396462613334, --companion-credentials, 56211473591d5de6d426ae0a49cf76b0030b45c8b4bd8c7db97181219ce19302:2d848afe96bb95a2e4fe21cf90d6eca12187fbe86ba35810802969b1ca489db4:38364633373839392d453045372d344541372d424339452d423337383635423344443546:61313130373931342d653236662d343733662d396363652d313865303235313539356337, all_features]
2024-01-04 22:18:56.778 [INFO ] [ding.appletv.internal.AppleTVHandler] - Features: Features{features=[FeatureInfo{name='Up', state=Available, options={}}, FeatureInfo{name='Down', state=Available, options={}}, FeatureInfo{name='Left', state=Available, options={}}, FeatureInfo{name='Right', state=Available, options={}}, FeatureInfo{name='Play', state=Available, options={}}, FeatureInfo{name='PlayPause', state=Available, options={}}, FeatureInfo{name='Pause', state=Available, options={}}, FeatureInfo{name='Stop', state=Available, options={}}, FeatureInfo{name='Next', state=Unavailable, options={}}, FeatureInfo{name='Previous', state=Unavailable, options={}}, FeatureInfo{name='Select', state=Available, options={}}, FeatureInfo{name='Menu', state=Available, options={}}, FeatureInfo{name='VolumeUp', state=Available, options={}}, FeatureInfo{name='VolumeDown', state=Available, options={}}, FeatureInfo{name='Home', state=Available, options={}}, FeatureInfo{name='HomeHold', state=Available, options={}}, FeatureInfo{name='TopMenu', state=Available, options={}}, FeatureInfo{name='SkipForward', state=Available, options={}}, FeatureInfo{name='SkipBackward', state=Available, options={}}, FeatureInfo{name='SetPosition', state=Available, options={}}, FeatureInfo{name='SetShuffle', state=Unavailable, options={}}, FeatureInfo{name='SetRepeat', state=Unavailable, options={}}, FeatureInfo{name='ChannelUp', state=Available, options={}}, FeatureInfo{name='ChannelDown', state=Available, options={}}, FeatureInfo{name='Title', state=Available, options={}}, FeatureInfo{name='Artist', state=Unavailable, options={}}, FeatureInfo{name='Album', state=Unavailable, options={}}, FeatureInfo{name='Genre', state=Unavailable, options={}}, FeatureInfo{name='TotalTime', state=Unavailable, options={}}, FeatureInfo{name='Position', state=Available, options={}}, FeatureInfo{name='Shuffle', state=Unavailable, options={}}, FeatureInfo{name='Repeat', state=Unavailable, options={}}, FeatureInfo{name='SeriesName', state=Unavailable, options={}}, FeatureInfo{name='SeasonNumber', state=Unavailable, options={}}, FeatureInfo{name='EpisodeNumber', state=Unavailable, options={}}, FeatureInfo{name='ContentIdentifier', state=Unavailable, options={}}, FeatureInfo{name='AppList', state=Available, options={}}, FeatureInfo{name='LaunchApp', state=Available, options={}}, FeatureInfo{name='AccountList', state=Available, options={}}, FeatureInfo{name='SwitchAccount', state=Available, options={}}, FeatureInfo{name='Artwork', state=Available, options={}}, FeatureInfo{name='App', state=Available, options={}}, FeatureInfo{name='PushUpdates', state=Available, options={}}, FeatureInfo{name='PlayUrl', state=Available, options={}}, FeatureInfo{name='StreamFile', state=Available, options={}}, FeatureInfo{name='PowerState', state=Available, options={}}, FeatureInfo{name='TurnOn', state=Available, options={}}, FeatureInfo{name='TurnOff', state=Available, options={}}, FeatureInfo{name='Volume', state=Available, options={}}, FeatureInfo{name='SetVolume', state=Available, options={}}]}
2024-01-04 22:18:56.778 [INFO ] [ding.appletv.internal.AppleTVHandler] - Event Scanner: null
2024-01-04 22:18:56.779 [INFO ] [nding.appletv.internal.PyATV$Scanner] - AppleTVEventScanner: start()
2024-01-04 22:18:56.779 [INFO ] [nding.appletv.internal.PyATV$Scanner] - AppleTVEventScanner: starting handler threads
2024-01-04 22:18:56.780 [INFO ] [nding.appletv.internal.PyATV$Scanner] - AppleTVEventScanner: Scanner starting
2024-01-04 22:18:56.780 [INFO ] [ding.appletv.internal.AppleTVHandler] - Command Scanner: null
2024-01-04 22:18:56.780 [INFO ] [nding.appletv.internal.PyATV$Scanner] - AppleTVEventScanner: Commander starting
2024-01-04 22:18:56.780 [INFO ] [nding.appletv.internal.PyATV$Scanner] - aieee
2024-01-04 22:18:56.780 [INFO ] [nding.appletv.internal.PyATV$Scanner] - AppleTVCommandLoop: start()
2024-01-04 22:18:56.781 [WARN ] [nding.appletv.internal.PyATV$Scanner] - AppleTVEventScanner process not running. waiting 500ms. Scanner{name='AppleTVEventScanner', process=null, isStarted=true, expectedCommandLine='null'}
2024-01-04 22:18:56.781 [INFO ] [nding.appletv.internal.PyATV$Scanner] - AppleTVCommandLoop: starting handler threads
2024-01-04 22:18:56.781 [INFO ] [nding.appletv.internal.PyATV$Scanner] - AppleTVCommandLoop: Scanner starting
2024-01-04 22:18:56.782 [INFO ] [nding.appletv.internal.PyATV$Scanner] - AppleTVCommandLoop: Commander starting
2024-01-04 22:18:56.782 [INFO ] [nding.appletv.internal.PyATV$Scanner] - aieee
2024-01-04 22:18:56.783 [WARN ] [nding.appletv.internal.PyATV$Scanner] - AppleTVCommandLoop process not running. waiting 500ms. Scanner{name='AppleTVCommandLoop', process=null, isStarted=true, expectedCommandLine='/var/lib/openhab/tmp/appletv-binding/bin/atvscript -i 48E15C67397B --raop-credentials :82f302c6d712ec4e205c5bacd9cb79f3f016a0f9e00089954235696bd7a5c800::35805657597c72d1 --airplay-credentials 56211473591d5de6d426ae0a49cf76b0030b45c8b4bd8c7db97181219ce19302:b1faf619242f1efa09718f3edb5121e2e60cc8ea5de1dfbe5dcb5ef2995aa770:38364633373839392d453045372d344541372d424339452d423337383635423344443546:64323461613333362d653738642d343037612d623838342d626530376162396462613334 --companion-credentials 56211473591d5de6d426ae0a49cf76b0030b45c8b4bd8c7db97181219ce19302:2d848afe96bb95a2e4fe21cf90d6eca12187fbe86ba35810802969b1ca489db4:38364633373839392d453045372d344541372d424339452d423337383635423344443546:61313130373931342d653236662d343733662d396363652d313865303235313539356337 command_loop'}
2024-01-04 22:18:56.784 [WARN ] [nding.appletv.internal.PyATV$Scanner] - PATH: /var/lib/openhab/tmp/appletv-binding/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin
2024-01-04 22:18:56.785 [INFO ] [nding.appletv.internal.PyATV$Scanner] - Started process 2276176
2024-01-04 22:18:56.785 [INFO ] [nding.appletv.internal.PyATV$Scanner] - Process 2276176 isRunning=true
2024-01-04 22:18:56.785 [INFO ] [nding.appletv.internal.PyATV$Scanner] - AppleTVEventScanner: Running /var/lib/openhab/tmp/appletv-binding/bin/atvscript -i 48E15C67397B --raop-credentials :82f302c6d712ec4e205c5bacd9cb79f3f016a0f9e00089954235696bd7a5c800::35805657597c72d1 --airplay-credentials 56211473591d5de6d426ae0a49cf76b0030b45c8b4bd8c7db97181219ce19302:b1faf619242f1efa09718f3edb5121e2e60cc8ea5de1dfbe5dcb5ef2995aa770:38364633373839392d453045372d344541372d424339452d423337383635423344443546:64323461613333362d653738642d343037612d623838342d626530376162396462613334 --companion-credentials 56211473591d5de6d426ae0a49cf76b0030b45c8b4bd8c7db97181219ce19302:2d848afe96bb95a2e4fe21cf90d6eca12187fbe86ba35810802969b1ca489db4:38364633373839392d453045372d344541372d424339452d423337383635423344443546:61313130373931342d653236662d343733662d396363652d313865303235313539356337 push_updates
2024-01-04 22:18:56.786 [WARN ] [nding.appletv.internal.PyATV$Scanner] - PATH: /var/lib/openhab/tmp/appletv-binding/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin
2024-01-04 22:18:56.786 [INFO ] [nding.appletv.internal.PyATV$Scanner] - Started process 2276178
2024-01-04 22:18:56.787 [INFO ] [nding.appletv.internal.PyATV$Scanner] - Process 2276178 isRunning=true
2024-01-04 22:18:56.787 [INFO ] [nding.appletv.internal.PyATV$Scanner] - AppleTVCommandLoop: Running /var/lib/openhab/tmp/appletv-binding/bin/atvscript -i 48E15C67397B --raop-credentials :82f302c6d712ec4e205c5bacd9cb79f3f016a0f9e00089954235696bd7a5c800::35805657597c72d1 --airplay-credentials 56211473591d5de6d426ae0a49cf76b0030b45c8b4bd8c7db97181219ce19302:b1faf619242f1efa09718f3edb5121e2e60cc8ea5de1dfbe5dcb5ef2995aa770:38364633373839392d453045372d344541372d424339452d423337383635423344443546:64323461613333362d653738642d343037612d623838342d626530376162396462613334 --companion-credentials 56211473591d5de6d426ae0a49cf76b0030b45c8b4bd8c7db97181219ce19302:2d848afe96bb95a2e4fe21cf90d6eca12187fbe86ba35810802969b1ca489db4:38364633373839392d453045372d344541372d424339452d423337383635423344443546:61313130373931342d653236662d343733662d396363652d313865303235313539356337 command_loop
2024-01-04 22:18:57.838 [INFO ] [nding.appletv.internal.PyATV$Scanner] - queueing command: artwork
2024-01-04 22:19:02.841 [INFO ] [nding.appletv.internal.PyATV$Scanner] - queueing command: playing
^C

Ditto ps:

omr@shs2:~$ ps aux | grep -i atv
openhab  2028430  0.0  0.5  73460 20956 ?        S    16:26   0:13 /var/lib/openhab/tmp/appletv-binding/bin/python3 /var/lib/openhab/tmp/appletv-binding/bin/atvscript -i 48E15C67397B --raop-credentials :82f302c6d712ec4e205c5bacd9cb79f3f016a0f9e00089954235696bd7a5c800::35805657597c72d1 --airplay-credentials 56211473591d5de6d426ae0a49cf76b0030b45c8b4bd8c7db97181219ce19302:b1faf619242f1efa09718f3edb5121e2e60cc8ea5de1dfbe5dcb5ef2995aa770:38364633373839392d453045372d344541372d424339452d423337383635423344443546:64323461613333362d653738642d343037612d623838342d626530376162396462613334 --companion-credentials 56211473591d5de6d426ae0a49cf76b0030b45c8b4bd8c7db97181219ce19302:2d848afe96bb95a2e4fe21cf90d6eca12187fbe86ba35810802969b1ca489db4:38364633373839392d453045372d344541372d424339452d423337383635423344443546:61313130373931342d653236662d343733662d396363652d313865303235313539356337 push_updates
openhab  2028474  0.0  0.5  73464 22000 ?        S    16:26   0:13 /var/lib/openhab/tmp/appletv-binding/bin/python3 /var/lib/openhab/tmp/appletv-binding/bin/atvscript -i 48E15C67397B --raop-credentials :82f302c6d712ec4e205c5bacd9cb79f3f016a0f9e00089954235696bd7a5c800::35805657597c72d1 --airplay-credentials 56211473591d5de6d426ae0a49cf76b0030b45c8b4bd8c7db97181219ce19302:b1faf619242f1efa09718f3edb5121e2e60cc8ea5de1dfbe5dcb5ef2995aa770:38364633373839392d453045372d344541372d424339452d423337383635423344443546:64323461613333362d653738642d343037612d623838342d626530376162396462613334 --companion-credentials 56211473591d5de6d426ae0a49cf76b0030b45c8b4bd8c7db97181219ce19302:2d848afe96bb95a2e4fe21cf90d6eca12187fbe86ba35810802969b1ca489db4:38364633373839392d453045372d344541372d424339452d423337383635423344443546:61313130373931342d653236662d343733662d396363652d313865303235313539356337 command_loop
omr      2271693  0.0  0.0   9076  2360 pts/0    S+   22:13   0:00 grep --color=auto -i atv
omr@shs2:~$ ps aux | grep -i atv
openhab  2276176  1.5  1.3  73464 54680 ?        S    22:18   0:00 /var/lib/openhab/tmp/appletv-binding/bin/python3 /var/lib/openhab/tmp/appletv-binding/bin/atvscript -i 48E15C67397B --raop-credentials :82f302c6d712ec4e205c5bacd9cb79f3f016a0f9e00089954235696bd7a5c800::35805657597c72d1 --airplay-credentials 56211473591d5de6d426ae0a49cf76b0030b45c8b4bd8c7db97181219ce19302:b1faf619242f1efa09718f3edb5121e2e60cc8ea5de1dfbe5dcb5ef2995aa770:38364633373839392d453045372d344541372d424339452d423337383635423344443546:64323461613333362d653738642d343037612d623838342d626530376162396462613334 --companion-credentials 56211473591d5de6d426ae0a49cf76b0030b45c8b4bd8c7db97181219ce19302:2d848afe96bb95a2e4fe21cf90d6eca12187fbe86ba35810802969b1ca489db4:38364633373839392d453045372d344541372d424339452d423337383635423344443546:61313130373931342d653236662d343733662d396363652d313865303235313539356337 push_updates
openhab  2276178  1.5  1.4  73612 55248 ?        S    22:18   0:00 /var/lib/openhab/tmp/appletv-binding/bin/python3 /var/lib/openhab/tmp/appletv-binding/bin/atvscript -i 48E15C67397B --raop-credentials :82f302c6d712ec4e205c5bacd9cb79f3f016a0f9e00089954235696bd7a5c800::35805657597c72d1 --airplay-credentials 56211473591d5de6d426ae0a49cf76b0030b45c8b4bd8c7db97181219ce19302:b1faf619242f1efa09718f3edb5121e2e60cc8ea5de1dfbe5dcb5ef2995aa770:38364633373839392d453045372d344541372d424339452d423337383635423344443546:64323461613333362d653738642d343037612d623838342d626530376162396462613334 --companion-credentials 56211473591d5de6d426ae0a49cf76b0030b45c8b4bd8c7db97181219ce19302:2d848afe96bb95a2e4fe21cf90d6eca12187fbe86ba35810802969b1ca489db4:38364633373839392d453045372d344541372d424339452d423337383635423344443546:61313130373931342d653236662d343733662d396363652d313865303235313539356337 command_loop
omr      2276917  0.0  0.0   9076  2372 pts/0    R+   22:19   0:00 grep --color=auto -i atv
omr@shs2:~$ ^C

Hi-

I just want to clarify: you are explicitly powering down the AppleTV, or it’s going to sleep after the specified amount of time? It’s possible that the device simply isn’t announcing that it’s shutting down before it does so, which would be difficult for us to detect.

I think there are some changes in the way the AppleTV reports its status, “sleep” reporting worked correctly under TVOS 16, though a sleeping device needed to be sent a “wakeup” command before it would respond to any other requests. I’ll have to take a look here and see if I can replicate the problem. Might take a few days… I’ll post back.

I have it set to Never sleep.
When done viewing, I do a long press on the Siri remote power button.
TV shuts down first, then the light on the ATV goes out.
Wakes it up with the Siri remote home button.

An update …
The binding now appears stable and connected.
I’m very happy now doing automations. Thanx. :slight_smile:

2 things have changed:
I had several remote entries after playing with the python API and this binding.
I wiped them all, and did a re authentication. Now looks like:

TVios 17.3 came along.

Looking at the log however, makes me wonder if things are as intended or not?

2024-02-04 11:50:46.930 [ERROR] [ding.appletv.internal.AppleTVHandler] - ATV command threw exception: I/O operation on closed file:
2024-02-04 11:50:46.935 [WARN ] [nding.appletv.internal.PyATV$Scanner] - PATH: /var/lib/openhab/tmp/appletv-binding/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin
2024-02-04 11:52:46.930 [ERROR] [ding.appletv.internal.AppleTVHandler] - ATV command threw exception: I/O operation on closed file:
2024-02-04 11:52:46.944 [WARN ] [nding.appletv.internal.PyATV$Scanner] - PATH: /var/lib/openhab/tmp/appletv-binding/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin
2024-02-04 11:54:39.720 [WARN ] [enhab.binding.appletv.internal.PyATV] - PaTH: /var/lib/openhab/tmp/appletv-binding/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin
2024-02-04 11:54:40.802 [WARN ] [enhab.binding.appletv.internal.PyATV] - PaTH: /var/lib/openhab/tmp/appletv-binding/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin
2024-02-04 11:55:21.044 [ERROR] [ding.appletv.internal.AppleTVHandler] - ATV command threw exception: I/O operation on closed file:
2024-02-04 11:55:21.054 [WARN ] [nding.appletv.internal.PyATV$Scanner] - PATH: /var/lib/openhab/tmp/appletv-binding/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin
2024-02-04 11:57:21.030 [ERROR] [ding.appletv.internal.AppleTVHandler] - ATV command threw exception: I/O operation on closed file:
2024-02-04 11:57:21.055 [WARN ] [nding.appletv.internal.PyATV$Scanner] - PATH: /var/lib/openhab/tmp/appletv-binding/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin
2024-02-04 11:58:50.693 [ERROR] [ding.appletv.internal.AppleTVHandler] - ATV command threw exception: I/O operation on closed file:
2024-02-04 11:58:50.708 [WARN ] [nding.appletv.internal.PyATV$Scanner] - PATH: /var/lib/openhab/tmp/appletv-binding/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin
2024-02-04 11:59:41.900 [WARN ] [enhab.binding.appletv.internal.PyATV] - PaTH: /var/lib/openhab/tmp/appletv-binding/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin
2024-02-04 11:59:42.980 [WARN ] [enhab.binding.appletv.internal.PyATV] - PaTH: /var/lib/openhab/tmp/appletv-binding/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin
2024-02-04 12:00:30.250 [ERROR] [ding.appletv.internal.AppleTVHandler] - ATV command threw exception: I/O operation on closed file:
2024-02-04 12:00:30.260 [WARN ] [nding.appletv.internal.PyATV$Scanner] - PATH: /var/lib/openhab/tmp/appletv-binding/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin
2024-02-04 12:02:30.267 [ERROR] [ding.appletv.internal.AppleTVHandler] - ATV command threw exception: I/O operation on closed file:
2024-02-04 12:02:30.275 [WARN ] [nding.appletv.internal.PyATV$Scanner] - PATH: /var/lib/openhab/tmp/appletv-binding/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin
2024-02-04 12:04:30.263 [ERROR] [ding.appletv.internal.AppleTVHandler] - ATV command threw exception: I/O operation on closed file:
2024-02-04 12:04:30.268 [WARN ] [nding.appletv.internal.PyATV$Scanner] - PATH: /var/lib/openhab/tmp/appletv-binding/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin
2024-02-04 12:04:44.120 [WARN ] [enhab.binding.appletv.internal.PyATV] - PaTH: /var/lib/openhab/tmp/appletv-binding/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin
2024-02-04 12:04:45.169 [WARN ] [enhab.binding.appletv.internal.PyATV] - PaTH: /var/lib/openhab/tmp/appletv-binding/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin
2024-02-04 12:04:57.862 [WARN ] [enhab.binding.appletv.internal.PyATV] - PaTH: /var/lib/openhab/tmp/appletv-binding/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin
2024-02-04 12:06:30.276 [ERROR] [ding.appletv.internal.AppleTVHandler] - ATV command threw exception: I/O operation on closed file:
2024-02-04 12:06:30.281 [WARN ] [nding.appletv.internal.PyATV$Scanner] - PATH: /var/lib/openhab/tmp/appletv-binding/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin
2024-02-04 12:08:30.290 [ERROR] [ding.appletv.internal.AppleTVHandler] - ATV command threw exception: I/O operation on closed file:
2024-02-04 12:08:30.301 [WARN ] [nding.appletv.internal.PyATV$Scanner] - PATH: /var/lib/openhab/tmp/appletv-binding/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin
2024-02-04 12:09:46.307 [WARN ] [enhab.binding.appletv.internal.PyATV] - PaTH: /var/lib/openhab/tmp/appletv-binding/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin
2024-02-04 12:09:47.471 [WARN ] [enhab.binding.appletv.internal.PyATV] - PaTH: /var/lib/openhab/tmp/appletv-binding/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin
2024-02-04 12:10:20.298 [ERROR] [ding.appletv.internal.AppleTVHandler] - ATV command threw exception: I/O operation on closed file:
2024-02-04 12:10:20.307 [WARN ] [nding.appletv.internal.PyATV$Scanner] - PATH: /var/lib/openhab/tmp/appletv-binding/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin
2024-02-04 12:12:20.309 [ERROR] [ding.appletv.internal.AppleTVHandler] - ATV command threw exception: I/O operation on closed file:
2024-02-04 12:12:20.315 [WARN ] [nding.appletv.internal.PyATV$Scanner] - PATH: /var/lib/openhab/tmp/appletv-binding/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin

But, as said, ignoring the log, it seems to work OK.
I have the following items:

To my delight I found I could do sendCommand() to the all of them, except playMode, but sending play/pause to the remoteKey did the trick!

When both TV and ATV is sleeping, sending ON to powerStatus wakes them both up.
(and OFF turns them both off)

This now works in my sitemap, and of cause my DSL rules:

Switch item=AppleTVLRAppId mappings=[org.radioplayer.tvos=Radio, com.canaldigital.twe=T-We ] label=AppleTV icon=screen|
Switch item=AppleTVLRRemoteKey mappings=[pause=Pause, play=Play ] label=AppleTV icon=screen|

Thanks again @hww3

I’m glad it’s working for you. I’ll try to start documenting the details such as you’ve noted in the README file. Some of the output you’ve pasted is mostly for debug purposes while I’m working on improving the binding’s behavior, and once things become more stable will mostly disappear. The pyatv tools seem to quit occasionally and those messages indicate something that probably should be fixed (if I can figure out what’s causing them.)

Please do keep me posted with any problems you might run into!

1 Like

Hi Bill

Thanks for an awesome binding …
I’d broke my pyatv and it is now working again.

Just one question … is there support for volume up and volume down buttons?

Hi-

I think volume up/down is present… give me a few days to find a little time and I’ll see if I can test them. Will report back!

Thanks Bill,

I’m not sure if it relevant, but I’m running openHAB 3.4.2 and 3.3 SNAPSHOT of the appletv binding.
It wasn’t clear 9(to me) whether I could run the v4.x version of the binding with OH 3.4.2

R

1 Like

Hi-

  1. I took a look and it appears that the volume up and down commands are being sent, but that the Apple TV device doesn’t actually do anything with them. I should note that the Apple TV is just relaying the command on to the connected TV using HDMI/CEC or IR. I realize this is a bit unsatisfying, but you could achieve similar results by commanding the device that actually has the audio out.

  2. Unfortunately there were a number of changes starting in OH 4.0 that make bindings incompatible with previous versions. It might be possible to apply the changes since your version that didn’t involve 4.0 compatibility, but I think that would probably be a fair amount of effort.

Hi Bill

thanks for looking into this

R