Display `entity_picture` in `picture-entity` card

The picture-entity card is able to show either a static image, or a camera stream/still.

Unless I’m missing something, it doesn’t seem to be able to show the entity’s entity_picture attribute as the picture, which seems like it should be an obvious fallback (like it already does if it points to a camera entity). The entity_picture appears as a thumbnail alongside the entity itself, but if it has a picture attribute, any reason not to show that picture as the image of the picture-entity card?

For example, if the image url is omitted, and the camera_image entity is omitted, the entity attribute does not point to a camera entity, but points to an entity that has entity_picture, why can’t it show that picture?

The closest I’ve been able to find that can do this is using the Markdown card, and manually inserting the image as markdown:

content: >-
  ![]({{states.sensor.$entity.attributes.entity_picture}})

But I would like to keep the L&F of the picture-entity card (i.e., showing the entity name and state at the bottom).

Agreed! The use case I’m looking at for this is to use custom:auto-entities to show a card that shows thumbnails for everyone who is home. Right now I have to hardcode everyone’s picture-entity cards like this:

type: grid
square: true
columns: 4
cards:
  - show_name: false
    camera_view: auto
    type: picture-entity
    entity: person.john_boiles
    aspect_ratio: '1'
    image: /api/image/serve/517e62a39f167828c075e3012e53e3b4/512x512
    show_state: false
    state_filter:
      home: saturate(1)
      not_home: saturate(0) opacity(30%)
  - type: picture-entity
    entity: person.dubledore
    aspect_ratio: '1'
    show_name: false
    image: /api/image/serve/bee6bc2b65623305d933df311f395ab0/512x512
    show_state: false
    state_filter:
      home: saturate(1)
      not_home: saturate(0) opacity(30%)
  - type: picture-entity
    entity: person.harry_potter
    aspect_ratio: '1'
    show_name: false
    image: /api/image/serve/bee6bc2b65623305d933df311f395ab0/512x512
    show_state: false
    state_filter:
      home: saturate(1)
      not_home: saturate(0) opacity(30%)

With custom:auto-entities it could be more like this (if this feature were implemented). Then the card wouldn’t need to be updated when new people were added.

type: custom:auto-entities
card:
  type: grid
card_param: cards
filter:
  include:
    - domain: person
      options:
        type: picture-entity
        show_state: false
        show_name: false
        aspect_ratio: '1'
        state_filter:
          home: saturate(1)
          not_home: saturate(0) opacity(30%)

Which would be much cleaner when you had a lot of people (I’m using HA in an office setting).

An alternative implementation would be to allow image to be templateable with entity as an input. Something like this:

image: {{ state_attr(entity, 'entity_picture') }}
2 Likes