AppleTV integration scripting

I’m trying to figure out how to control my AppleTV via Home Assistant. There are only a few example scripts out there and they are both limited and dated. Here’s my first script attempt. I’m just trying to get it to consistently open the Infuse app.

xx_infuse:
  sequence:
    - service: remote.send_command
      data:
        entity_id: remote.apple_tv_livingroom
        command:
          - top_menu
    - delay: 00:00:02
    - service: remote.send_command
      data:
        entity_id: remote.apple_tv_livingroom
        command:
          - home
    - delay: 00:00:02
    - service: remote.send_command
      data:
        entity_id: remote.apple_tv_livingroom
        command:
          - select

First of all, I don’t see any documentation as to what the difference is between the menu, top_menu and home commands are. Can anyone explains what these commands do? I’m trying to get the what I call the Home screen. Unfortunately the “Home” command seems to take me to the AppleTV app, not the Home screen. Top_Menu and Menu seem to act differently depending on what app I’m currently in. If I’m in Netflix, the MENU command takes me to the Netflix Menu.

Finally, I can in some cases use a sequence like HOME,MENU that will get me to the Home screen…the problem then is that the Home screen seems to remember what icon your on. So I cannot write a script that sends HOME, MENU, RIGHT, RIGHT to get to the 3rd icon on the Home screen, because if I was last on the 2nd icon…RIGHT, RIGHT will take me to the 4th icon.

Can anyone show me a script that will always get me to the Home screen and icon #1 (top left icon)?

1 Like

Did you ever find a solution and/or more knowledge about what the commands do?

I’m currently struggling with my very first script in Home Assistant and it’s for and Apple TV, too.
I cannot save the script because I’m getting an Message malformed: extra keys not allowed @ data['studio_appletv_zdf'] error. Here’s my script attempt:
Screenshot 2022-10-12 at 10.28.41

Any ideas?