Stuck with an simple automation rule

Good Morning, I think I´m stuck with an rather simple automation rule and I just don´t get what I´m doing wrong.

It sounds so simple: When turning on my AV Receiver, an LED stripe is supposed to turn on as well, but only when the sun has set. However, the light won´t turn on and the state of the sun was definitly below horizon.

This is the part of my config

- id: '1533666227236'
  alias: led-tv-bank-on
  trigger:
    entity_id: media_player.yamaha_receiver
    platform: state
    to: 'on'
  condition:
    condition: state
    entity_id: sun.sun
    state: below_horizon
  action:
    service: scene.turn_on
    entity_id: scene.livingroom_normal

Try this:

- id: '1533666227236'
  alias: led-tv-bank-on
  trigger:
    - platform: state
      entity_id: media_player.yamaha_receiver
      to: 'on'
  condition:
    - condition: state
      entity_id: sun.sun
      state: 'below_horizon'
  action:
    - service: scene.turn_on
      entity_id: scene.livingroom_normal

Thanks, I will try it later at home after work.
I have to admit I havn´t read much basics of the syntax yet (Top of my list for the holiday):

One question concerncing that:

Is there a simple, short explantion for what the “-” (minus, hyphen) stands for? In some
examples they are there, in some they aren´t.

I’m not a 100% sure but I think you require it if you have multiple triggers/conditions/actions. If you only have one, you can get away without doing it but I just like to use them in the event I add some more.

Also if that doesn’t work, the other thing you’ll have to look for is if your media_player state is “on” or if it should be “playing” instead.

would it be possible to place an “or” in the trigger? (playing or on)

You can have multiple triggers and they are by design ‘or’ Any trigger will trigger the automation.

It just so happens I provided an explanation just the other day :slight_smile: :

Maybe you will find this useful as well. FWIW, I don’t think this is your problem.

I agree with @Jer78, I think this may be your problem. I’m pretty sure most media_players’ states are typically ‘playing’ when they’re “on”, although I believe some might actually set their state to ‘on’.