Binding for Apple-TV

Great work!
I will test it now.
Was just about to sit down and have another go, but you beat me to it :slight_smile: .

I believe AI is hallucinating here, because I’m fairly certain this openhab/tmp folder is populated by these manual steps we have to do every time there is a new OH version. Regular restarts should be OK.

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

Edit:


Only difference is that my python version was 3.12 instead of 3.11 :slight_smile:

No hero and not a spare per se, but I have a second ATV4k in my basement den with no current automations, but connected to OH. I could, from now on do updates on that one first, and post here whether new updates are OK or not.

Worked for me as well. Thx! :slight_smile:

Others experiencing stale channel updates lately?
After turning on with remote, hours later power channel shows off.
Disabling and reenabling updates to true state again.
I’m on 5.2.0M2

not sure when it happened but my instance has errors rigtht now and i cant fix them

Version: 5.1.4 (Build)

2026-06-13 14:04:22.250 [WARN ] [ding.appletv.internal.AppleTVHandler] - Pairing failed: 2026-06-13 14:04:21 ERROR [pyatv.protocols.companion]: Could not fetch SystemStatus, power_state will not work (Command FetchAttentionState failed)
Traceback (most recent call last):
  File "/usr/lib/python3.13/asyncio/tasks.py", line 507, in wait_for
    return await fut
           ^^^^^^^^^
  File "/usr/lib/python3.13/asyncio/locks.py", line 213, in wait
    await fut
asyncio.exceptions.CancelledError

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/var/lib/openhab/tmp/appletv-binding/lib/python3.13/site-packages/pyatv/protocols/companion/api.py", line 172, in _send_command
    resp = await self._protocol.exchange_opack(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )
    ^
  File "/var/lib/openhab/tmp/appletv-binding/lib/python3.13/site-packages/pyatv/protocols/companion/protocol.py", line 153, in exchange_opack
    return await self._exchange_generic_opack(frame_type, data, identifier, timeout)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/var/lib/openhab/tmp/appletv-binding/lib/python3.13/site-packages/pyatv/protocols/companion/protocol.py", line 166, in _exchange_generic_opack
    unpacked_object = await self._queues[identifier].wait(timeout)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/var/lib/openhab/tmp/appletv-binding/lib/python3.13/site-packages/pyatv/support/collections.py", line 161, in wait
    await asyncio.wait_for(self._event.wait(), timeout)
  File "/usr/lib/python3.13/asyncio/tasks.py", line 506, in wait_for
    async with timeouts.timeout(timeout):
               ~~~~~~~~~~~~~~~~^^^^^^^^^
  File "/usr/lib/python3.13/asyncio/timeouts.py", line 116, in __aexit__
    raise TimeoutError from exc_val
TimeoutError

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/var/lib/openhab/tmp/appletv-binding/lib/python3.13/site-packages/pyatv/protocols/companion/__init__.py", line 219, in initialize
    system_status = await self.api.fetch_attention_state()
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/var/lib/openhab/tmp/appletv-binding/lib/python3.13/site-packages/pyatv/protocols/companion/api.py", line 439, in fetch_attention_state
    resp = await self._send_command("FetchAttentionState", {})
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/var/lib/openhab/tmp/appletv-binding/lib/python3.13/site-packages/pyatv/protocols/companion/api.py", line 183, in _send_command
    raise exceptions.ProtocolError(f"Command {identifier} failed") from ex
pyatv.exceptions.ProtocolError: Command FetchAttentionState failed
12:54:B9:78:AA:8B

@hww3
Any chance you could share your latest binding source? (5.0.1)
Or if you already did, where can i find it?

Thanks.

Hello-

The source is located at:

I’m traveling this week, but should be able to spend a little time looking at this when I return mid-next-week.

Thanks, but both I and my AI agent is at a loss as to how to build a jar from this source.
AI claims it can only find version 4.3.2, but I am currently running version 5.0.1 of the binding.
Any pointers?

The code for both versions is the same, it’s just that the openhab it’s built against is different.

I’m currently out of town for work, but will be back home in a few days and can try to get an up-to-date version prepared for testing.