Automation - what is wrong here?

Pulling my hair out for the last hours.

- alias: Film Ende
  trigger:
    platform: state
    entity_id: media_player.kodi_wohnzimmer, media_player.schwarzes_kastchen
    to: 'idle'
  condition:
    - condition: state
      entity_id: light.wohnzimmer_stehlampe
      state: 'on'
  action:
    service: light.turn_on
    data:
      entity_id: light.wohnzimmer_stehlampe
      color_temp: 400
      brightness_pct: 100
      transition: 4

- alias: Licht an, wenn Film schon spielt
  trigger:
    platform: state
    entity_id: light.wohnzimmer.stehlampe
    to: 'on'
  condition:
    - condition: state
      entity_id: media_player.kodi_wohnzimmer, media_player.schwarzes_kastchen
      state: 'playing'
  action:
    service: light.turn_on
    data:
      entity_id: light.wohnzimmer_stehlampe
      color_temp: 453
      brightness_pct: 20
      transition: 3

The second alias does not work, hass complains: “Invalid config”. It must be something obvious, but I do net see it :frowning:
What I want to achieve: If a film is running, and someone turns the light on (while the film is running), then I want to set the light to a defined state (temperature, brightness)
Any help is appreciated,

Rainer

Try taking the comma out of the alias line.

Change condition in second automation to:

  condition:
    - condition: state
      entity_id: media_player.kodi_wohnzimmer
      state: 'playing'
    - condition: state
      entity_id: media_player.schwarzes_kastchen
      state: 'playing'

That will require both to be playing. If you want it to run if either is playing, then:

  condition:
    condition: or
    conditions:
      - condition: state
        entity_id: media_player.kodi_wohnzimmer
        state: 'playing'
      - condition: state
        entity_id: media_player.schwarzes_kastchen
        state: 'playing'

Still invalid :frowning:

- alias: Licht an wenn Film schon spielt
  trigger:
    platform: state
    entity_id: light.wohnzimmer.stehlampe
    to: 'on'
#  condition:
#    - condition: state
#      entity_id: media_player.kodi_wohnzimmer, media_player.schwarzes_kastchen
#      state: 'playing'
  condition: or
  conditions:
    - condition: state
      entity_id: media_player.kodi_wohnzimmer
      state: 'playing'
    - condition: state
      entity_id: media_player.schwarzes_kastchen
      state: 'playing'
  action:
    service: light.turn_on
    data:
      entity_id: light.wohnzimmer_stehlampe
      color_temp: 453
      brightness_pct: 20
      transition: 3

hass 0.80.3 on Raspian

should be:
light.wohnzimmer_stehlampe

Good find!

But the config is still invalid :frowning:

There should be one upper “condition” and quoted lines idented under it. See here Conditions - Home Assistant

- alias: Licht an wenn Film spielt
  trigger:
    platform: state
    entity_id: light.wohnzimmer_stehlampe
    to: 'on'
#  condition:
#    - condition: state
#      entity_id: media_player.kodi_wohnzimmer, media_player.schwarzes_kastchen
#      state: 'playing'
  conditon:
    condition: or
    conditions:
      - condition: state
        entity_id: media_player.kodi_wohnzimmer
        state: 'playing'
      - condition: state
        entity_id: media_player.schwarzes_kastchen
        state: 'playing'
  action:
    service: light.turn_on
    data:
      entity_id: light.wohnzimmer_stehlampe
      color_temp: 453
      brightness_pct: 20
      transition: 3

Invalid :frowning:
I give up for today/tonight.

What would really really help everyone to assist you here would be if instead of just saying “invalid” you posted the actual error message, which will tell you exactly what is wrong, and we can then help you fix it.

1 Like

I’d really want to provide the error, but there is noting but “invalid config” in the UI. Nothing in home-assistant.log.

The actual config is here: https://gitlab.sokoll.com/rainer/home-assistant/tree/%2310

The error message will be immediately below where it says invalid config.

You’ve missed the second letter I out of the word condition.

1 Like

@anon43302295 Oh my bad - you’re correct. it was the missing “i” - and there was no more information in the UI, I swear.
Thank you so much!