Automation Trigger using Media Player Source

Hello - I’m going to sort out how to do the following. Under various attempts, it doesn’t seem to actually work.

I have my living room HTPC set up with WOL which works fine.

I’m trying to write an automation to do the following:

Trigger - AVR source is DVD
Action - HTPC turns on

Trigger - AVR source is CBL/SAT or is turned off
Action - HTPC turns off

This is what I have thus far - although the HTPC turns off when AVR is off, I can’t get it to turn off when I change the input. I’m not sure what the “platform” is…

I tried platform: source, but errors out.

  • alias: “Livingroom HTPC ON”
    trigger:

    • platform: state
      entity_id: media_player.denon
      state: ‘on’
      action:
      service: switch.turn_on
      entity_id: switch.livingroomhtpc
  • alias: “Livingroom HTPC OFF”
    trigger:

    • platform: state
      entity_id: media_player.denon
      state: ‘off’
    • platform: state
      entity_id: media_player.denon
      state: ‘CBL/SAT’
      action:
      service: switch.turn_off
      entity_id: switch.livingroomhtpc
2 Likes

Ugh amazing! Never ceases to amazing me how complete home assistant is.

Thank you very much!