Allow state_not in Conditions

I have never understood why ‘Conditions’ do not allow state_not (or something similar). Maybe there is a technical reason I don’t know about?

I know that it can easily be achieved with a template but a template does not allow the use of for.

To illustrate, I’d really like to be able to do something like this:

condition:
  platform: state
  entity_id: media_player.kitchen
  state_not: paused

Or better yet, allow for in a template condition (yeah, much harder to implement I expect but we can only ask):

condition:
  condition: template
  value_template: >
    {{ state_attr('media_player.kitchen', 'source') != 'TV') }}
  for:
    minute: 1

I know it’s messy but for this particular scenario you could use a set of ‘or’ conditions and that are all possible states other than ‘paused’…

Otherwise I think it’s a valid request if for nothing other than making the coding of such things easier.

Yes, I’ve thought of that but in general that requires you to know all possible states, something not always obvious.

And I try to avoid condition: or simply because the syntax ties my head in knots :slight_smile: especially if combined with other conditions. The nesting can get a bit crazy.

Apparently the supreme leader thinks that if you understand the concept of a not condition (or any other basic logic condition) then you must be a python developer so should do it yourself :roll_eyes:

…it is ok in Lovelace though :thinking:

I really, really don’t understand why ‘false’ is not allowed if ‘true’ is.

I must admit I had assumed there to be some totally valid technical reason to not have included ‘state_not’ (or similar).

I just can’t imagine the thought process that goes “let’s allow to check for True” without automatically thinking, “hmm, maybe we also might need to check for False”.

It almost follows by definition. Very strange indeed.

And as for the need to understand complex programming - shall we talk about the bizarre syntax structure for “condition: or”? And that is without considering nested or and and conditions which can become almost impossible to read.

Hey ho…

1 Like

I also missed this feature. This is quite useful in a sweet lot of cases. I think it’s really sad that such a main component of a smart home software lacks so much features.

As @anon43302295 posted the main developer seem to have a different view

I feel like a lot of components seem to be not finished and thought through

1 Like