UI improvement: allow for 'exclamation mark' to invert states

Please simplify the visual automations UI by allowing inverting states by just adding an exclamation mark before the state.

So in the UI when you insert an exclamation mark in the ‘from’ or ‘to’ field, see below


that it changes this:

trigger: state
entity_id:
  - input_boolean.test
to: "!off"

to this:

trigger: state
entity_id:
  - input_boolean.test
not_to: "off"

Would also be nice to invert conditions this way.

Advantages:

  • in visual UI it would allow using ‘not’ (also not_to & not_from) in triggers, which is currently not possible,
  • It’s quicker to invert conditions just by inserting an exclamation mark instead of moving the condition in a ‘not’ condition block.

I’m not sure that makes sense as the exclamation mark is inside the quotes which means it’s part of the string and not an operator in its own right.

1 Like

You are right. The idea was born from the wish to invert states from the UI and I got a bit lost there…

I have rewritten the original post. I hope this makes more sense! :sweat_smile:

1 Like

What would be a usecase for this? My first though is that you could have a lot of strange things happening when a state goes to “Unknown”, for example.

Let’s say you have a 3d printer and you want notifications for all states except when all goes well, then using not_to: ‘printing’ would alert when there is an error but also when the there is no connection, or when it runs out of filament.

Another example. Get location updates of your kids, except when they are ‘home’, etc.

1 Like

To work around with what we have today I do the trigger as just state change, then in the condition start with a not, then the state that you don’t want inside the not condition. I can send a screenshot later if you need.