Apple TV On HassOS

Will I be able to get the apple_tv platform to work on HassOS?
As per the documentation https://www.home-assistant.io/integrations/apple_tv/ it seems like I would need some extra libraries.
And I assume I cannot install those in HassOS.

All I need is to read out attributes from apple_tv to use in an automation.

Right now I am testing out the installation without the Ubuntu VM, running only HassOS.

Everything needed is already bundled with Hass.io (no matter if running on HassOS or not). But if you want to add an Apple TV running tvOS you need to use the beta component until I have merged it back into Home Assistant. I recommend that you install with HACS to get automatic updates.

3 Likes

Thank you for info and for your effort in writing this integration.

I pulled the beta down using HACS😊

I got confused, though: restart or not restart?

You need to restart Home Assistant. This integration supports config_flow, that means that you now can go to the integration section of your UI to configure it.
No restart required :tada:

1 Like

That is some clear instructions right there :wink: I guess there are two things here. Since it’s a custom component, you need to restart Home Assistant in order to get it since Home Assistant can’t hotload components/integrations. Once you have it available in HA, then you don’t have to restart when adding new Apple TVs after that (due to confg flows).

I just got confused when the text is telling me:

You need to restart Home Assistan

While the same paragraph also includes the sentence

No restart required :tada:

:slight_smile:

Setup was a breeze, @postlund :wink: thank you for simplifying this :+1:t2: :smiley:

Yeah, that is strange


Great, hope it works well! If you find any bugs, please report them in the pyatv repo on GitHub! :+1:

1 Like

There is one thing I don’t understand:
How can I ensure the Apple TV is accessible?
In the image below the “power” button is switched off. This prevents the Automation to run, even when the Apple TV device is playing content.
Any tips how I can make sure it’s switched on for the automation?

I’m not sure I follow? Does it switch off by itself? If turned off it will be in “off” state but it doesn’t turn off the Apple TV.

The Apple TV itself is running, and playing content.
The switch is in the OFF state (see image).
The Apple TV, ‘media_player.stua_1_etg’ state is ‘playing’

My automation is triggered by this state, but do not work if the state is off.

When switching it ON ( see below) it works.

How do ensure ‘media_player.stua_1_etg’ is ‘on’ or ‘state: idle’ ?

This looks like an impossible situation to me, I don’t really understand it. It f the device is off, the fronted renders “Off” in the title (with localization). That is not possible to override as far as I know. Do you see anything in the logs? Maybe you can enable these:


logger:
  logs:
    pyatv: debug
    custom_components.apple_tv: debug

Hey @postlund,

Would you mind posting an example yaml snippet to use the remote entities?
I’m having I’m trying to use the ‘wake’ command outlined in pyatv as a script to turn on my Apple TV. Beta working great apart from that :slight_smile:

Cheers

Linton

Hi @LintHart!

I should be exactly the same as what is currently bundled with Home Assistant (see here):

service: remote.send_command
data:
  entity_id: remote.apple_tv
  command:
    - wakeup

Thank you so much! You have no idea how long I’ve been trying to build a sleep button for my Apple TV 4. The hold_home command was just a myth for the longest time

bedroom_atv_off:
  alias: Bedroom AppleTV Off
  sequence:
    - service: remote.send_command
      data:
        entity_id: remote.bedroom
        command:
          - home_hold
    - delay: 00:00:03
    - service: remote.send_command
      data:
        entity_id: remote.bedroom
        command:
          - select
2 Likes

You’re welcome :blush: This is a common request from a lot of people, nice to see that there are workarounds at least.

I am so thrilled this works for putting my ATV to sleep and wake it up. @postlund

However it seems depending on the remote state to work; the remote must be in the “on” state?

How do I get the remote and the ATV itself to allways be in the on or idle state?

It will be on/idle only with an open connection. So if it turned off in Home assistant (or if Home
Assistant loses connection), then the both the media player and remote will be (logically) off.

As a workaround for turning on (assuming it does not do that when turning on the entity), you can write a script that turns on the media player/remote, wait for idle state and then sends wakeup.

When would this script be triggered?

I would assume that you use it when you want I turn on the physical device (in case CEC doesn’t kick in)? I’m not sure I fully understand the usecase here when I’m thinking about it.