postlund / pyatv

A client library for Apple TV and AirPlay devices
https://pyatv.dev
MIT License
839 stars 91 forks source link

"power_off" in Home Assistant? #2184

Closed brad-newman closed 9 months ago

brad-newman commented 9 months ago

What do you need help with?

I'm sending the "suspend" command to my ATV, which works in powering it off, but sometimes I can't wake my ATV after, even with the physical remote. The only solution is to unplug and plug back in.

I don't see "power_off" in the HA ATV integration documentation, but see you've deprecated "suspend" here and replaced it with power_off (perhaps in part because of the issues I'm experiencing?)

Is there a different solution for HA, am I missing something? Thank you!

brad-newman commented 9 months ago

Properly implemented the home_hold script as documented:

apple_tv_sleep:
  alias: "Make the Apple TV sleep"
  sequence:
    - service: remote.send_command
      target:
        entity_id: remote.lounge_appletv
      data:
        delay_secs: 1
        command:
          - home_hold
          - select
    - service: media_player.turn_off
      target:
        entity_id: media_player.lounge_appletv