same here
it works if I reload the page
Ok, I got it working with a little patience.
Thanks for your help,
Does this works ?!
Wow, that doesnāt seem normal, although the field thatās actually interesting is the time⦠none of them seem to have used much more than 1 second of CPU time. Are your atvscript instances exiting right after starting?
For example, hereās my openhab instance, and you can see that my 2 atvscript instances have very modest usage:
PID USERNAME SIZE RSS STATE PRI NICE TIME CPU PROCESS/NLWP
56801 mosquit* 14M 2660K cpu9 1 0 2217:26:0 6.7% mosquitto/1
4372 openhab 1035M 835M sleep 59 0 0:15:51 0.0% java/371
80936 openhab 149M 48M sleep 59 0 0:00:00 0.0% npm-cli.js/12
24841 openhab 82M 65M sleep 2 0 0:00:04 0.0% atvscript/3
4630 openhab 82M 65M sleep 59 0 0:00:44 0.0% atvscript/3
47294 nut 13M 1376K sleep 59 0 0:05:50 0.0% upsd/1
80938 openhab 238M 144M sleep 1 0 0:00:16 0.0% node/12
47413 nut 12M 1856K sleep 59 0 0:01:30 0.0% upsmon/1
47292 nut 13M 1596K sleep 59 0 0:13:27 0.0% snmp-ups/1
47411 root 11M 1048K sleep 59 0 0:00:00 0.0% upsmon/1
You can use ps to see when the process was started.
All pids are just active for a few seconds, so yes, all exit, but the PC gets warm, so the CPU usage is real.
Just tried a reboot. Ends up the same:
Couple of things are new here:
New PC, Asus PL64 with 5 core Intel(R) Celeron(R) 7305
Cloned the disk from my old system running Ubuntu 22.04 LTS and on the new PC upgraded to 24.04.2 LTS (SMART on old system reported SSD powered up for more than 7yrs ⦠)
Updated to Java 21 and openHAB 5.0.0.M1
After that I had to do the usual:
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
Strange ā¦
Wondering if it can be related to the exception thrown when parsing the āartworkā command?
2025-04-21 14:52:03.638 [INFO ] [nding.appletv.internal.PyATV$Scanner] - Started process 22865
2025-04-21 14:52:03.639 [INFO ] [nding.appletv.internal.PyATV$Scanner] - Process 22865 isRunning=true
2025-04-21 14:52:03.639 [INFO ] [nding.appletv.internal.PyATV$Scanner] - AppleTVCommandLoop: Running /var/lib/openhab/tmp/appletv-binding/bin/atvscript -i 86F37899E0E7 --raop-credentials 56211473591d5de6d426ae0a49cf76b0030b45c8b4bd8c7db97181219ce19302:9d7a02c59acc4302fb8cc439e61d1cbfd00175b308c83659dcb267ee59c4a522:38364633373839392d453045372d344541372d424339452d423337383635423344443546:65373333656336312d303530632d346335312d616239662d376232623263343163386537 --airplay-credentials 56211473591d5de6d426ae0a49cf76b0030b45c8b4bd8c7db97181219ce19302:d404ea7937ff459014cb8c47979b0ea61697d0fc08415530982bd2008b6296b0:38364633373839392d453045372d344541372d424339452d423337383635423344443546:38343736356264392d363566392d343636632d623564662d633333636237383933636232 --companion-credentials 56211473591d5de6d426ae0a49cf76b0030b45c8b4bd8c7db97181219ce19302:0b2928cdda3465ae4c75f425d0577859e687279d3621b819da19b6a3f8e6db01:38364633373839392d453045372d344541372d424339452d423337383635423344443546:66663361316465342d343462372d343363642d626665652d626466363032333662643530 command_loop
2025-04-21 14:52:04.823 [INFO ] [nding.appletv.internal.PyATV$Scanner] - AppleTVEventScanner: Command process=22854 exited.
2025-04-21 14:52:04.824 [INFO ] [nding.appletv.internal.PyATV$Scanner] - Process 22854 exists.
2025-04-21 14:52:04.828 [WARN ] [nding.appletv.internal.PyATV$Scanner] - PATH: /var/lib/openhab/tmp/appletv-binding/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/snap/bin
2025-04-21 14:52:04.829 [INFO ] [nding.appletv.internal.PyATV$Scanner] - Started process 22870
2025-04-21 14:52:04.829 [INFO ] [nding.appletv.internal.PyATV$Scanner] - Process 22870 isRunning=true
2025-04-21 14:52:04.829 [INFO ] [nding.appletv.internal.PyATV$Scanner] - AppleTVEventScanner: Running /var/lib/openhab/tmp/appletv-binding/bin/atvscript -i 86F37899E0E7 --raop-credentials 56211473591d5de6d426ae0a49cf76b0030b45c8b4bd8c7db97181219ce19302:9d7a02c59acc4302fb8cc439e61d1cbfd00175b308c83659dcb267ee59c4a522:38364633373839392d453045372d344541372d424339452d423337383635423344443546:65373333656336312d303530632d346335312d616239662d376232623263343163386537 --airplay-credentials 56211473591d5de6d426ae0a49cf76b0030b45c8b4bd8c7db97181219ce19302:d404ea7937ff459014cb8c47979b0ea61697d0fc08415530982bd2008b6296b0:38364633373839392d453045372d344541372d424339452d423337383635423344443546:38343736356264392d363566392d343636632d623564662d633333636237383933636232 --companion-credentials 56211473591d5de6d426ae0a49cf76b0030b45c8b4bd8c7db97181219ce19302:0b2928cdda3465ae4c75f425d0577859e687279d3621b819da19b6a3f8e6db01:38364633373839392d453045372d344541372d424339452d423337383635423344443546:66663361316465342d343462372d343363642d626665652d626466363032333662643530 push_updates
2025-04-21 14:52:05.861 [INFO ] [nding.appletv.internal.PyATV$Scanner] - queueing command: artwork
2025-04-21 14:52:05.864 [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.12/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.12/site-packages/pyatv/support/shield.py", line 71, in _guard_method
raise BlockedStateError(f"{func.__name__} is blocked")
pyatv.exceptions.BlockedStateError: metadata is blocked
2025-04-21 14:52:05.864 [INFO ] [nding.appletv.internal.PyATV$Scanner] - AppleTVCommandLoop: response handler returned false.
2025-04-21 14:52:05.864 [INFO ] [nding.appletv.internal.PyATV$Scanner] - AppleTVCommandLoop: Command process=22865 exited.
2025-04-21 14:52:05.865 [INFO ] [nding.appletv.internal.PyATV$Scanner] - Process 22865 exists.
2025-04-21 14:52:05.865 [INFO ] [nding.appletv.internal.PyATV$Scanner] - destroying process 22865 forcibly.
2025-04-21 14:52:05.870 [WARN ] [nding.appletv.internal.PyATV$Scanner] - PATH: /var/lib/openhab/tmp/appletv-binding/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/snap/bin
2025-04-21 14:52:05.871 [INFO ] [nding.appletv.internal.PyATV$Scanner] - Started process 22873
2025-04-21 14:52:05.871 [INFO ] [nding.appletv.internal.PyATV$Scanner] - Process 22873 isRunning=true
2025-04-21 14:52:05.871 [INFO ] [nding.appletv.internal.PyATV$Scanner] - AppleTVCommandLoop: Running /var/lib/openhab/tmp/appletv-binding/bin/atvscript -i 86F37899E0E7 --raop-credentials 56211473591d5de6d426ae0a49cf76b0030b45c8b4bd8c7db97181219ce19302:9d7a02c59acc4302fb8cc439e61d1cbfd00175b308c83659dcb267ee59c4a522:38364633373839392d453045372d344541372d424339452d423337383635423344443546:65373333656336312d303530632d346335312d616239662d376232623263343163386537 --airplay-credentials 56211473591d5de6d426ae0a49cf76b0030b45c8b4bd8c7db97181219ce19302:d404ea7937ff459014cb8c47979b0ea61697d0fc08415530982bd2008b6296b0:38364633373839392d453045372d344541372d424339452d423337383635423344443546:38343736356264392d363566392d343636632d623564662d633333636237383933636232 --companion-credentials 56211473591d5de6d426ae0a49cf76b0030b45c8b4bd8c7db97181219ce19302:0b2928cdda3465ae4c75f425d0577859e687279d3621b819da19b6a3f8e6db01:38364633373839392d453045372d344541372d424339452d423337383635423344443546:66663361316465342d343462372d343363642d626665652d626466363032333662643530 command_loop
2025-04-21 14:52:07.050 [INFO ] [nding.appletv.internal.PyATV$Scanner] - AppleTVEventScanner: Command process=22870 exited.
2025-04-21 14:52:07.050 [INFO ] [nding.appletv.internal.PyATV$Scanner] - Process 22870 exists.
2025-04-21 14:52:07.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:/snap/bin
2025-04-21 14:52:07.055 [INFO ] [nding.appletv.internal.PyATV$Scanner] - Started process 22876
2025-04-21 14:52:07.055 [INFO ] [nding.appletv.internal.PyATV$Scanner] - Process 22876 isRunning=true
2025-04-21 14:52:07.055 [INFO ] [nding.appletv.internal.PyATV$Scanner] - AppleTVEventScanner: Running /var/lib/openhab/tmp/appletv-binding/bin/atvscript -i 86F37899E0E7 --raop-credentials 56211473591d5de6d426ae0a49cf76b0030b45c8b4bd8c7db97181219ce19302:9d7a02c59acc4302fb8cc439e61d1cbfd00175b308c83659dcb267ee59c4a522:38364633373839392d453045372d344541372d424339452d423337383635423344443546:65373333656336312d303530632d346335312d616239662d376232623263343163386537 --airplay-credentials 56211473591d5de6d426ae0a49cf76b0030b45c8b4bd8c7db97181219ce19302:d404ea7937ff459014cb8c47979b0ea61697d0fc08415530982bd2008b6296b0:38364633373839392d453045372d344541372d424339452d423337383635423344443546:38343736356264392d363566392d343636632d623564662d633333636237383933636232 --companion-credentials 56211473591d5de6d426ae0a49cf76b0030b45c8b4bd8c7db97181219ce19302:0b2928cdda3465ae4c75f425d0577859e687279d3621b819da19b6a3f8e6db01:38364633373839392d453045372d344541372d424339452d423337383635423344443546:66663361316465342d343462372d343363642d626665652d626466363032333662643530 push_updates
Hmm. Thatās interesting. I donāt think Iāve seen that error before. Can you let me know what devices youāre using and what OS version theyāre running? Maybe itās something obvious that I can easily fix. Do you happen to know if this is a new behavior? Itās not uncommon for these processes to exit periodically, but in my limited experience, they should last more than a few seconds (usually hours to days, depending on how much interaction you do with the devices).
That exception was also present in one of my previous posts in this thread so I have always had them. (Binding for Apple-TV - #209 by OMR - Bindings - openHAB Community)
Here is my scan result:
(appletv-binding) omr@shs3:~$ time atvremote scan
Scan Results
========================================
Name: Denon AVC-X4700H
Model/SW: Denon AVC-X4700H, Unknown OS
Address: 192.168.1.106
MAC: 00:06:78:6C:CC:0A
Deep Sleep: False
Identifiers:
- 00:06:78:6C:CC:0A
- 0006786CCC0A
Services:
- Protocol: AirPlay, Port: 7000, Credentials: None, Requires Password: False, Password: None, Pairing: NotNeeded
- Protocol: RAOP, Port: 7000, Credentials: None, Requires Password: False, Password: None, Pairing: NotNeeded
Name: Kjellerstua
Model/SW: AppleTV14,1, Unknown OS 18.4
Address: 192.168.1.100
MAC: 7A:ED:BA:67:8D:CE
Deep Sleep: False
Identifiers:
- 7A:ED:BA:67:8D:CE
- 7AEDBA678DCE
Services:
- Protocol: AirPlay, Port: 7000, Credentials: None, Requires Password: False, Password: None, Pairing: Mandatory
- Protocol: Companion, Port: 50699, Credentials: None, Requires Password: False, Password: None, Pairing: Mandatory
- Protocol: RAOP, Port: 7000, Credentials: None, Requires Password: False, Password: None, Pairing: Mandatory
Name: Living Room
Model/SW: AppleTV14,1, Unknown OS 18.4.1
Address: 192.168.1.126
MAC: 86:F3:78:99:E0:E7
Deep Sleep: False
Identifiers:
- 86:F3:78:99:E0:E7
- 86F37899E0E7
Services:
- Protocol: AirPlay, Port: 7000, Credentials: None, Requires Password: False, Password: None, Pairing: Mandatory
- Protocol: Companion, Port: 55083, Credentials: None, Requires Password: False, Password: None, Pairing: Mandatory
- Protocol: RAOP, Port: 7000, Credentials: None, Requires Password: False, Password: None, Pairing: Mandatory
Name: Samsung Q90 Series (75)
Model/SW: QRQ90, Unknown OS
Address: 192.168.1.133
MAC: D0:D0:03:09:5B:BE
Deep Sleep: False
Identifiers:
- D0:D0:03:09:5B:BE
Services:
- Protocol: AirPlay, Port: 38775, Credentials: None, Requires Password: False, Password: None, Pairing: Mandatory
real 0m4.054s
user 0m1.070s
sys 0m0.078s
(appletv-binding) omr@shs3:~$
My device interaction is limited and only through the OH binding:
Have a rule rerouting some audio on my AVR according to play mode, and power off (aka standby) when I go to bed.
Switch AppleTVLRPower (media) { channel = "appletv:device:86-F3-78-99-E0-E7:playStatus#powerStatus" }
String AppleTVLRRemoteKey "[]" (media) { channel = "appletv:device:86-F3-78-99-E0-E7:control#remoteKey" }
String AppleTVLRPlayMode "[]" (media) { channel = "appletv:device:86-F3-78-99-E0-E7:playStatus#playMode" }
String AppleTVLRAppName "[]" (media) { channel = "appletv:device:86-F3-78-99-E0-E7:playStatus#appName" }
String AppleTVLRAppId "[]" (media) { channel = "appletv:device:86-F3-78-99-E0-E7:playStatus#appId" }
Ok, so looks like a modern device. Seems like the binding is maybe not waiting for the previous command to finish? Iāll look through my device logs and see if I can find an example of the problem here that I can reproduce. Just from the messages you sent it looks like commands are being sent too quickly, ie artwork before the results of metadata are being returned.
Iāll look into this and get back to you.
Thanks!
Yes, 4K Eth devices with USB-C remotes ā¦
Thanks so far ā¦
Iād like to chime in with @OMR - iām seeing the same thing. I have not changed hardware, but updated my linux, and temps are spiking. I am running 3 ATVās all 4K gen2/3, and there is alot of cpu usage with each instance, i get around 15C extra temperature on my cpu, so running all 3 things, my cpu is around 100C, but disabling the 3 things, i get steady temps around 55C.
Thatās interesting. My setup is obviously different and Iām not seeing this behavior. I donāt have a good answer for why this is happening yet, but am trying to come up with a solution. I will note that the error āmetadata is blockedā is coming from pyatv, so itās not a binding bug per se. Hopefully the answer is just slowing the requests down a bit.
The increase in temperature is due to the constant exceptions killing and restarting the processes.
Ok, some updates. I have started to get this error here, though I donāt get constant spinning for some reason. I think thatās probably an unrelated problem. I also think the problem is more general than just the artwork error; itās simply that the artwork command is run whenever thereās a play status update delivered, and that always happens immediately when the push_update command first runs.
Specifically about this problem: Thereās some talk over on the pyatv issue tracker that this may be related to some changes in tvOS 18.4. It doesnāt look like thereās a fix (yet). Iāve got an older (non-4k) AppleTV somewhere here that isnāt up to date. Iāll try setting that one up and seeing if thereās a different behavior.
Also, I found one or two little parsing errors related to differences in the data returned now, so either way, I should have a slightly better version in a few days.
Any progress?
A fix for the problem is working its way through testing. The developer says a new release with a bug fix should be ready in a week or two. Then we can update the code used here, which /should/ happen pretty quickly. Iāll post back here when I have something ready to test.
Bill
Any update?
I just checked out the lates development version: 0.16.1 (July 12th)
pip3 install --upgrade git+https://github.com/postlund/pyatv.git
From GitHub - postlund/pyatv: A client library for Apple TV and AirPlay devices
Unsure exactly which Issue or PR addresses this problem.
Still crashes and hence hogs CPU, but apparently functions as expected. I have it mostly disabled though as my fanless PC runs a bit hot.
Hey everyone, quick question, Iām currently considering moving from my Google tv with Chromecast to something better and the Apple TV is being considered.
Whatās the overall opinion on it as a device and it integration with OpenHAB? Can I expect a similar thing like with Google Chromecast?