Picture entity card - state filter, can I do a 'not' operator?

Back when I started with HA, I posted a feature request for doing a ‘not’ operator on state_filter.
I can see it can be done in a Entity Filter Card (it has the != operator way), even the conditional in picture entity card has it. Has it been implemented in state_filter for picture entity, and just me that can’t figure it out, or is it still missing?

The reason is that I have set up several zone’s in HA, and I’ve made a state_filter for ‘not_home’ to apply a grayscale to the picture, it works perfectly as long as the zone is ‘undefined’, ie. set to not_home but if it shows something else like ‘Mall’ or ‘School’ or something else it doesn’t apply the filter (of course).

So I can make extra template sensors for this to be true for home, and false for anything else, but it seems like overkill to do that, or I can include all the zones in a state filter, but either way, it is silly.

According to the examples, it should be possible to add a filter for the standard picture, but I’m unsure if I can revert that for a state. Furthermore it doesn’t seem to apply to the picture at all.

So far I’ve tried this.

This doesn’t work, it is never grayscaled.

 aspect_ratio: 100%
 entity: person.nathalie
 hold_action: none
 image: /local/images/person_nathalie_home.jpg
 show_name: false
 show_state: false
 filter: grayscale(100%)
 state_filter:
   home: grayscale(0%)
 tap_action: none
 type: picture-entity

This way it doesn’t show ‘away’ if the zone is something else than ‘not_home’

aspect_ratio: 100%
entity: person.kenneth
hold_action: none
image: /local/images/person_kenneth_home.jpg
show_name: false
show_state: false
state_filter:
  not_home: grayscale(100%)
tap_action: none
type: picture-entity

Hey Fribse,
I would create a binary sensor that gets tripped when the user is home. That way if they are anywhere else it would show as off. Then you could have the Entity Filter card monitor that instead. Would that accomplish what you are trying to do?

binary_sensor:
  - platform: template
    sensors:
      user_home:
        friendly_name: "User Home"
        value_template: >-
          {{ states.person.nathalie.state == 'home' }}
1 Like

Yeah, that’s what I did for now:

binary_sensor:
  - platform: template
    sensors:
      person_nathalie:
        friendly_name: "Is Nathalie Home"
        value_template: "{{ is_state('person.nathalie','home') }}"

And the card is then:

aspect_ratio: 100%
entity: binary_sensor.person_nathalie
hold_action: none
image: /local/images/person_nathalie_home.jpg
show_name: false
show_state: false
state_filter:
  'off': grayscale(100%)
tap_action: none
type: picture-entity

But I still find it to be an omission that it’s not in the state_filter.