Not able to set not-condition in automation

My aim was to set this condition to an automation:


  • condition: device
    type: is_on
    device_id: 683b24df148811ebb2f409cf78486065
    entity_id: light.bad_decke
    domain: light
  • condition: not
    • condition: device
      device_id: c864becd148711eba159bf1de483ef7f
      domain: media_player
      entity_id: media_player.mini_bad
      type: is_playing

So that it runs only if the light is on but the player is NOT playing.

Not idea, if this is right, but I have no chance to test it as this YAML-configuration will not be saved.

After saving the YAML-config, it switches back to what I configured with the graphical interface.
But with the graphical config I cannot use NOT-condition.

What is my mistake?

Since you did not format the yaml it is difficult to tell exactly. This is what it should be - I think.

  - condition: state
    entity_id: 'light.bad_decke'
    state: 'on'
  - condition: not
      - condition: state
        entity_id: media_player.mini_bad
        state: 'is_playing'
1 Like

That seems to work!

Thanks a lot for your immediate support!

Kind regards