Picture Glance state_image not configured correctly

Hi everyone,

Hope you are all doing well. I had a question about a Picture Glance card. I am trying to get the image to change based on state. I can’t quite seem to figure out what am doing wrong. This is what I have:

type: picture-glance
title: chris
entities:
  - person.chris
state_image:
  Work: /local/chris - BW.png
  home: /local/chris1.png
  not_home: /local/chris - BW.png
entity: sensor.phone_battery_level

Any direction would be appreciated!

The state_image options use the entity variable.

Try like this:

type: picture-glance
title: chris
entities:
  - person.chris
state_image:
  Work: /local/chris - BW.png
  home: /local/chris1.png
  not_home: /local/chris - BW.png
entity: person.chris

just use a state filter

type: picture-glance
title: chris
entity: person.chris
image: /local/chris1.png
state_filter:
  Work: grayscale(100%)
  'not_home': grayscale(100%)

EDIT: Yes @Menelao pointed out you need to use entity

updated to this not grabbing the image…

type: picture-glance
title: chris
entities:
  - person.chris
state_image:
  Work: /local/chris - BW.png
  Home: /local/chris1.png
  not_home: /local/chris - BW.png
entity: sensor.moto_battery_level

Not an image issue as this works fine…

type: picture-glance
title: chris
entities:
  - person.chris
state_image:
image: /local/chris1.png

Thanks again

You’re still doing it wrong…

type: picture-glance
title: chris
entities:
  - sensor.moto_battery_level
state_image:
  Work: /local/chris - BW.png
  Home: /local/chris1.png
  not_home: /local/chris - BW.png
entity: person.chris

If you use as states “Work - Home and not_home” you need to use an entity that provide such states.

which should be his person

1 Like

so…

type: picture-glance
title: Anna
entities:
  - sensor.moto_g_7_battery_level
state_image:
  Work: /local/Anna - BW.png
  Home: /local/Anna1.png
  not_home: /local/Anna - BW.png
entity: person.anna

yeah, but you don’t need to make a black and white image… you can use the state_filter like i mentioned above and only have a single image.

Tried it this way:

type: picture-glance
title: Anna
entities:
  - person.anna
image:  /local/Anna1.png
state_filter:
  Home: greyscale(100%)
  J-Work: greyscale(100%)
entity: sensor.moto_g_7_battery_level

and this way:

type: picture-glance
title: Anna
entities:
  - sensor.moto_g_7_battery_level
image:  /local/Anna1.png
state_filter:
  Home: greyscale(100%)
  J-Work: greyscale(100%)
entity: person.anna

Still doing something wrong…

that’s not a valid state.

it’s ‘home’ or ‘not_home’ or zone friendly name.

To verify the correct states, go to the developer tools / states page. The state in the state column is what you want to use.

that is 100% wrong, stop trying it.

So I tried ‘home’, but everytime I go back in to look, it has been changed to home…

entity: person.anna
image: /local/Anna1.png
show_name: false
state_filter:
  J-work: greyscale(100%)
  home: greyscale(100%)
type: picture-entity

what?

Can you just post a screenshot of person.anna in the developer tools / states page. Include the attributes.

Also, when you reply to people click this reply, not the bottom reply.

Will do! Sorry about that.

Alright, so valid states are:

home
not_home
Zone Friendly Name

Zone firendly name is case sensative. So if your zone name is Anna Work then you MUST use Anna Work

this should work (assuming your zone name is J-Work) right out of the box.

type: picture-glance
entity: person.anna
image: /local/Anna1.png
show_name: false
state_filter:
  J-Work: greyscale(100%)
  home: greyscale(100%)

if that doesn’t work, this should

type: picture-glance
entity: person.anna
image: /local/Anna1.png
show_name: false
state_filter:
  J-Work: greyscale(100%)
  'home': greyscale(100%)


that’s because show_name isn’t an option. You keep switching between picture-entity and picture-glance. They do not share the same fields.

Stick with one or the other. If you want to keep picture glance, remove the show_name field.

EDIT:

It seems like state_folter is just broken. I tried this on both cards and it’s not working as the documents state.

EDIT2:
state_image is not broken. So use that:

type: picture-glance
title: Anna
entities:
  - sensor.moto_g_7_battery_level
state_image:
  Work: /local/Anna - BW.png
  home: /local/Anna1.png
  not_home: /local/Anna - BW.png
entity: person.anna

LAST EDIT: Greyscale is grayscale… it does work

type: picture-glance
entity: person.anna
entities:
  - sensor.moto_g_7_battery_level
image: /local/Anna1.png
state_filter:
  J-Work: grayscale(100%)
  home: grayscale(100%)

Perfection! Thanks for the help! Sorry for the confusion!

I looked through this topic but it seems this isn’t a solution for me.
This is my glance card:

  - badges: []
    cards:
      - aspect_ratio: 0%
        title: Keuken
        type: picture-glance
        entities:
          - entity: binary_sensor.keuken_motion
          - entity: group.afzuigkap
            icon: 'mdi:lightbulb-on-outline'
          - entity: light.aanrecht_2
          - entity: group.keuken
            icon: 'mdi:toggle-switch-off-outline'
        state_image:
          'on': /local/rooms/keuken-on.jpg
          'off': /local/rooms/keuken-off.jpg
        entity: group.keuken

But I can’t fix this error:
Expected a value of type undefinedforstate_imagebut received{“on”:"/local/rooms/keuken-on.jpg",“off”:"/local/rooms/keuken-off.jpg"}.
I looked at the lines and this topic, but I can’t figure out what’s wrong.

Is that error in the UI? If so, you can safely ignore it because it’s a warning not an error.