benct / lovelace-multiple-entity-row

Show multiple entity states and attributes on entity rows in Home Assistant's Lovelace UI

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Format: inconsistancy with "last-chaged" & "last-updated"

ildar170975 opened this issue · comments

Assume we need to show a last-changed (or last-updated) inside a secondary_info with some formatter like datetime.

Consider this card:

      - type: custom:multiple-entity-row
        entity: sun.sun
        entities:
          - entity: sun.sun
        show_state: false
        secondary_info:
          attribute: last-changed
          format: datetime

      - type: custom:multiple-entity-row
        entity: sun.sun
        entities:
          - entity: sun.sun
        show_state: false
        secondary_info:
          attribute: last-updated
          format: datetime

      - type: custom:multiple-entity-row
        entity: sun.sun
        entities:
          - entity: sun.sun
        show_state: false
        secondary_info:
          attribute: last_changed
          format: datetime

      - type: custom:multiple-entity-row
        entity: sun.sun
        entities:
          - entity: sun.sun
        show_state: false
        secondary_info:
          attribute: last_updated
          format: datetime

image

What we can see here:

  1. If attribute is specified like last-changed - then format is ignored.
  2. If attribute is specified like last_changed - then format is applied.

According to Docs, the last-changed name must be used.

Same for formatting these attributes inside "entities":

      - type: custom:multiple-entity-row
        entity: sun.sun
        secondary_info: format default
        entities:
          - attribute: last-changed
            name: last-changed
          - attribute: last-updated
            name: last-updated
        show_state: false
      - type: custom:multiple-entity-row
        entity: sun.sun
        secondary_info: format datetime
        entities:
          - attribute: last-changed
            name: last-changed
            format: datetime
          - attribute: last-updated
            name: last-updated
            format: datetime
        show_state: false
      - type: custom:multiple-entity-row
        entity: sun.sun
        secondary_info: format total
        entities:
          - attribute: last-changed
            name: last-changed
            format: total
          - attribute: last-updated
            name: last-updated
            format: total
        show_state: false
      - type: custom:multiple-entity-row
        entity: sun.sun
        secondary_info: format datetime
        entities:
          - attribute: last_changed
            name: last_changed
            format: datetime
          - attribute: last_updated
            name: last_updated
            format: datetime
        show_state: false
      - type: custom:multiple-entity-row
        entity: sun.sun
        secondary_info: format total
        entities:
          - attribute: last_changed
            name: last_changed
            format: total
          - attribute: last_updated
            name: last_updated
            format: total
        show_state: false

image