#Show date time as secondardy info

1 messages · Page 1 of 1 (latest)

empty storm
peak sky
#

I couldn't get the datetime formatting to work either. A workaround might be to use the custom:template-entity-row. (I don't remember if this was installed with multiple-entity-row or where it came from.)

type: vertical-stack
cards:
  - type: entities
    entities:
      - entity: binary_sensor.living_room_motion_detector_on_off
        type: custom:multiple-entity-row
        secondary_info:
          attribute: last-changed
          format: datetime
  - type: entities
    entities:
      - type: custom:template-entity-row
        entity: binary_sensor.living_room_motion_detector_on_off
        secondary: >-
          {{ states[config.entity].last_changed.astimezone().strftime("%A, %B %d, %Y @ %H:%M") }}
        state: >-
          {{ states(config.entity) }}
```I got the syntax for strftime from <https://www.w3schools.com/python/python_datetime.asp> but <https://strftime.org/> is also useful.
#

Two things that I noticed about going this route:

  • the state is not "friendly" but you can work that into the state: template
  state: >-
    {% set s = states(config.entity) %}
    {% if s == 'off' %}Clear
    {% elif s == 'on' %}Detected
    {% endif %}
  • the time is not local; shows UTC. That could also be worked into the template
    • added .astimezone() to the template above
      EDIT: Added state template