What is Best Way to do Not Condition in Automation

Hello there,

What is the correct way to do ‘not’ condition in Hass?
Here is an example of what im trying to achieve:

  • there is automation that is if the sensor detects motion then switch on the lights.
  • i want this automation to only work if chromecast is not in ‘playing’ state. If it is playing - dont switch on lights.

One of the way to do this is to create many or conditions, ie chromecast state is: idle,paused,off.
But is there any way to just say it is not playing?

If there is no such way is there a way to say in one line that chromecast state is in (idle,paused,off) like we do in SQL for example.


  condition: template
  value_template: "{{ not is_state('media.XXX', 'playing') }}"
1 Like