Doubt on condition using multiple states

Hi everyone.

Digging into documentation or searching in the forum didn’t help, so I’d rather just ask, just in case anyone knows:

Will the following:

    sequence:
      - not:
          - condition: state
            entity_id: media_player.mi_tv_stick
            attribute: app_id
            state: "com.google.android.tvlauncher"
          - condition: state
            entity_id: media_player.mi_tv_stick
            attribute: app_id
            state: "unknown"

work the same way as:

    sequence:
      - not:
          - condition: state
            entity_id: media_player.mi_tv_stick
            attribute: app_id
            state: 
              - "com.google.android.tvlauncher"
              - "unknown"

As per my understanding, if I don’t have the not, both would work the same (entity attribute could be either of the 2 values).

My doubt/question is: having the not, does the second option (using multiple states) make sure that none of the values exist for that entity attribute?

Thanks in advance and kind regards.

There is an implicit “and” in the first option.
There is an implicit “or” in the second option.

So the first will not work as you expect.

I understand that, but according to the documentation, the first option does work as I expect.

My question is actually what behavior to expect from the second option

No it will not be the same behaviour.

First example:

Not ( state_1 AND state_2 )

Second example:

Not ( state_1 OR state_2 )
1 Like

This won’t work because it is something like:

NOT ( state_A = X AND state_A = Y )

These inner conditions are excludents, you will never get both true.

X Y Result
true false true
false true true
false false true

So you will always get true for that whole condition.

NOT ( state_A = X OR state_A = Y )
X Y Result
true false false
false true false
false false true

That is what to expect from the second option.