Lovelace: add state_filter to Picture-Entity card

Hi All,

I was thinking, it would be great to have a state_filter options in Picture-Entity card, like in picture-elements card. For example, for Home presence:

  - type: picture-entity
    entity: device_tracker.user
    show_name: false
    image: /local/images/me.png
    state_filter:
      "not_home": brightness(70%) saturate(0.1)
      "home": brightness(100%) saturate(1)

I get what you want, but there’s already a solution: Make an image with 70% contrast for not_home. Name it differently than the home image. Then use state_image.

- type: picture-entity
  entity: device_tracker.user
  state_image:
    "not_home": /local/me_not_home.png
    "home": /local/me_home.png

Hi @petro, thanks for your answer! I’m just trying to don’t have a lot of pictures in server, because We will need a lot of different pictures for each entities… It is just simplier to modify images with css.

How can I do it, if I use FB profile pictures with direct links? :slight_smile: (or camera image?)
So, +1 for state_filter/state_style option!

You can’t without making 2 images. If the source is online, you have to go download the source. Make an image that’s 70% and swap between the 2 images. If you update your image online, you have to redo the process. Your other option is to code your own custom card using js, css, and html.

The question isn’t “How can I do it in other complex way?” - I know it.
The question is: Is it possible, to (somebody) extend the code with with the better solution we mentioned above?
(Yes, maybe I will do it - if nobody else. But I have to learn much about custom cards and coding in HA :confused: )

Anything is possible if you code it yourself.

I think this is quite reasonable, esp since it’s already supported on picture-element. And as this is an open source world, we shall go forth, implement and submit a pull request. But if someone is already working on it, it would be good to know so that we don’t do double work?