Picture-glance won't update picture on action

Hi, I am trying to setup picture-glance cards in my UI and so far I am successful. I set up a light switch with tap-action glance that should show an image to reflect if lights are on or off. It does everything I want/expect - except updating it’s image on tap.
Unless I F5 (or equivalent on mobile), it remains on the last state image since page refresh.

Is this a bug? Am I missing a setting?

what/how are you changing the image and what does your configuration look like?

My setup looks like this:

- type: picture-glance
  entity: light.bedroom
  state_image:
    'on': /local/bedroom_on.png
    'off': /local/bedroom_off.png
    'unavailable': /local/bedroom_off.png   show_state: false
  tap_action:
    action: toggle
  hold_action:
    action: more-info

As said, it works. I get the image I expect to see. The thing is, I have to refresh the page in order for it to update. I am used to see my switches show their state in realtime (or close to rt).
That’s why my question: Is this a bug or did I miss something?

I’m guessing it has to do with the spacing issues you have in that configuration. You had an extra space in most of your config. ALso, you had an extra attribute that isn’t allowed, show_state. Not sure where that came from.

- type: picture-glance
  entity: light.bedroom
  state_image:
    'on': /local/bedroom_on.png
    'off': /local/bedroom_off.png
    'unavailable': /local/bedroom_off.png
  tap_action:
    action: toggle
  hold_action:
    action: more-info

Hm, that spacing may be my bad. I did some free formating here to get the text sitting on the right (unlike in my yaml). It shouldn’t be (and isn’t) the issue in my yaml. Homeassistant would have complained if spacing was off - and I just checked it’s right too. (love notepad++ and it’s spacing markers!)

That “show state” was copied over from “picture-entity”, which I used as template to start with. My mistake. Fixed it. Didn’t help, sadly.

I am pretty sure there is nothing wrong with my yaml. I’m basicly just checking if I missed something or if it’s actualy HA who misses a line of code to update uppon tap-action.

it should update when you click it if light.bedroom is changing state

Based on the ones I have working:

In the docs:
entities
(list)(Required) List of entities or entity objects.

entity
(string)(Optional) Entity to use for state_image .

- type: picture-glance
  entities:
    - light.bedroom  
  state_image:
    'on': /local/bedroom_on.png
    'off': /local/bedroom_off.png
    'unavailable': /local/bedroom_off.png
  entity: light.bedroom
  tap_action:
    action: toggle
  hold_action:
    action: more-info

Could try this if no additional entities are required:

entities: []

I have placed scenes in the space for entities, so I can select them quickly.
My Picture-Glance works perfectly fine, except updating it’s state-image on toggle. It only updates on page refresh.

Strange I can’t replicate it, it works fine here.

Maybe post your exact config ?

Here are two combined screenshots, showing that the image won’t update by itself. The two lamps beneath are turned on and once I hit F5, the image updates correctly.


(That’s not my real room btw, just an artwork from google :wink: )

As for the config, I cut out all non-relevant parts while keeping it complete for stand-alone use:

title: Homeassistant
views:
  - title: Lights
    path: lights_view
    badges: []
    cards:
      - type: vertical-stack
        cards:
          - title: NAME
            type: picture-glance
            entity: light.bedroom
            state_image:
              "on": /local/bedroom_on.png
              "off": /local/bedroom_off.png
              "unavailable": /local/bedroom_off.png
            aspect_ratio: '16:9'
            tap_action:
              action: toggle
            hold_action:
              action: more-info
            entities: 
              - entity: scene.light_off
                icon: mdi:lightbulb-outline
              - entity: scene.light_dark
                icon: mdi:weather-night
              - entity: scene.light_sunset
                icon: mdi:weather-sunset-down
              - entity: scene.light_bright
                icon: mdi:chess-rook
              - entity: scene.light_nature
                icon: mdi:leaf
              - entity: switch.pc
                icon: mdi:desktop-classic
          - type: horizontal-stack
            cards:
              - name: NAME Top
                type: light
                entity: light.bedroom_light
              - name: NAME Ground
                type: light
                entity: light.bedroom_ground_light

Note: light.bedroom is the room itself, containing all lights within this room. This should allow for when turning on any light (while the other remains off), the state of the room turn on too. light.bedroom_light is the bulb on the ceiling while light.bedroom_ground_light is a LED-Strip on the ground.

I have just checked if in the “states”-screen (that “<>” icon on the front page) the entities update after switching on lights. And yes, all lights inkl. the room itself switch to “on” after clicking the picture. The image however remains gray - until F5.

what browser are you using?

On my PC Firefox.
On my mobile Safari, the html5 app (from placing the webpage to homescreen) and the dedicated app from app store.
Homeassistan is version 0.94.4.

what does your frontend: section look like in your configuration?

Maybe related to this, as your light.bedroom entity is a group ?

https://github.com/home-assistant/home-assistant-polymer/issues/3060

Looks like it. I have not tested it with a single light, since my plan was to show (and toggle) the entire room.

It’s an interesting issue that it would update on a single entity, but not on a set that is defined as a single entity - as in it’s not group.lights, but light.lights. Also the actual entity state does update correctly in both cases.

Funny enough, the card light (like the two light bulbs with brightness slider for top and ground light in my screenshot) does work with the same setting. (It’s what gave me the idea to use the more beatiful picture-glance instead of that bulb that looks identical to the single lights)

A work around would be to wrap the light group in a light template.

light:
  - platform: template
    lights:
      wrapped_bedroom:
        friendly_name: "Bedroom Lights"
        level_template: "{{ state_attr('light.bedroom', 'brightness') | int / 255 }}"
        value_template: "{{ state_attr('light.bedroom', 'brightness') }}"
        turn_on:
          service: light.turn_on
          entity_id: light.bedroom
        turn_off:
          service: light.turn_off
          entity_id: light.bedroom
        set_level:
          service: light.turn_on
          data_template:
            brightness: "{{ brightness }}"

I have tried to set my picture-glance to a single light, but it did not work out in the end, same issue as before.

I have decided to go a more long-road clean-result route instead.
I have switched my setup from picture-glance to picture-entity. This had one advantage and one disadvantage:
Pro is that it works out of the box like a charm. No bug, which is nice because the switch to picture-entity is very easy.
Cons is that I can not place my scenes in the card as before. They need a new one.

But actually that’s not that bad. You see, picture-glance allowes for entities to be listed within it’s status bar. But, at least for scenes, they do not work as “press to turn on”. It opens a second window to do that. So I happily switched them to a glance-card. Yes, it was a bit of a pain to make it properly work, but it was straight forward enough to get the result I want pretty fast. I’m happy with the new setup!

title: Homeassistant
views:
  - title: Lights
    path: lights_view
    badges: []
    cards:
      - type: vertical-stack
        cards:
          - name: NAME
            type: picture-entity
            entity: light.bedroom
            state_image:
              "on": /local/bedroom_on.png
              "off": /local/bedroom_off.png
              "unavailable": /local/bedroom_off.png
            show_state: false
            aspect_ratio: '16:9'
            tap_action:
              action: toggle
            hold_action:
              action: more-info
          - type: horizontal-stack
            cards:
              - type: glance
                show_name: true
                show_icon: true
                show_state: false
                entities: 
                  - entity: scene.light_off
                    icon: mdi:lightbulb-outline
                    tap_action:
                      action: call-service
                      service: scene.turn_on
                      service_data: 
                        entity_id: scene.light_off
                    hold_action:
                      action: none
                  - entity: scene.light_dark
                    icon: mdi:weather-night
                    tap_action:
                      action: call-service
                      service: scene.turn_on
                      service_data: 
                        entity_id: scene.light_dark
                    hold_action:
                      action: none
                  - entity: scene.light_sunset
                    icon: mdi:weather-sunset-down
                    tap_action: 
                      action: call-service
                      service: scene.turn_on
                      service_data: 
                        entity_id: scene.light_sunset
                    hold_action:
                      action: none
                  - entity: scene.light_bright
                    icon: mdi:chess-rook                    
                    tap_action:
                      action: call-service
                      service: scene.turn_on
                      service_data: 
                        entity_id: scene.light_bright
                    hold_action:
                      action: none
                  - entity: scene.light_nature
                    icon: mdi:leaf
                    tap_action:
                      action: call-service
                      service: scene.turn_on
                      service_data: 
                        entity_id: scene.light_nature
                    hold_action:
                      action: none
          - type: horizontal-stack
            cards:
              - name: NAME Top
                type: light
                entity: light.bedroom_light
              - name: NAME Ground
                type: light
                entity: light.bedroom_ground_light


Thanks to all helping me out here. Especialy thanks to @Holdestmade for linking the bug report, it helped me to understand the problem and make a better decision!

show_state might not be allowed, but it’s documented (Picture Glance Card - Home Assistant). It doesn’t appear to work like it does with a picture-entity card.

You’re replying to a 4 year old post. It didn’t exist at the time.