Door and motion sensor date stamp

hi

i have xiaomi door and motion sensor and i am using the Lovelace UI

i want to present the last time was motion on the sensor
and when last time the door was opened/Closed

such as:
image

Use the secondary_info last_changed option of the entities card.

Tnx for the reply

how i implement this , for example this is the code right now:

entities:

  • entity: binary_sensor.door_window_sensor_158d0002b5312
  • entity: binary_sensor.motion_sensor_158d0002b93f8
    type: entities
- type: entities
  title: Entities card sample
  entities:
    - entity: binary_sensor.door_window_sensor_158d0002b5312
      name: Window
      secondary_info: last-changed
    - entity: binary_sensor.motion_sensor_158d0002b93f8
      name: Motion
      secondary_info: last-changed

I get this Error

image

Look at the indentation of my example.
YAML is a bitch!

1 Like

This is 1:1 as your example, and still get error

image

:frowning:

Are these entity_id’s valid?
Please check in Dev Tools/states (< >)

Yes I can see the status

Do as asked please.

Why TF do people come here and ask for help, and then not respond to what is asked?

Confusion with the Ui Card Editor.
In yaml mode (what i use) there’s a hyphen in front of the type.
In the UI Card editor it is not.
So in the card editor it should look like

type: entities
title: Entities card sample
entities:
  - entity: binary_sensor.door_window_sensor_158d0002b5312
    name: Window
    secondary_info: last-changed
  - entity: binary_sensor.motion_sensor_158d0002b93f8
    name: Motion
    secondary_info: last-changed
1 Like

VDRainer, TNX for the help!

Now it show when the last action happened:
image

if i want the to see when the last action was in time (for example: 20:33)

u try to use this, but it not working:

type: entities
title: Entities card sample
entities:

  • entity: binary_sensor.door_window_sensor_158d0002b5312d
    name: Window
    secondary_info: last-changed
    format: datetime
  • entity: binary_sensor.motion_sensor_158d0002b93f81
    name: Motion
    secondary_info: last-changed
    format: datetime

Thats not possible, there is no format option for the secondary_info, it’s for the state value.

Hi

@VDRainer

i have question, i use the code according to your answers in 2 cards (sensor and device tracker, the code attached)

but if i reset the HA, the last change count only from the last reset, but if i check the data in the sensor i see different time:

After HA reset:

Sensor data:
image

The code:
entities:

  • entity: binary_sensor.door_window_sensor_158d0002b5312d
    name: Door Entry
    secondary_info: last-changed
  • entity: binary_sensor.motion_sensor_158d0002b93f81
    name: Living Room Motion
    secondary_info: last-changed
    show_header_toggle: false
    title: Entities card sample
    type: entities

This is normal

No clue with the data in the graph, but the graphs are always a little buggy.

How to add secondary_info: last-changed to type: custom:card-modder

My Card:

  • id: 743f96f9a2f14fc1b4415cab27bcd208
    type: vertical-stack
    cards:
    • type: custom:card-modder
      card:
      type: custom:mini-graph-card
      entities:
      - sensor.temperature_158d000271a6ce
      height: 65
      line_width: 2
      font_size: 70
      hours_to_show: 24
      line_color: ‘#3498db
      show:
      extrema: true
      legend: true
      icon: true
      style:
      background-image: url("/local/lovelace/background/cardbackk.png")
      background-repeat: no-repeat
      background-color: rgba(50,50,50,0.3)
      background-size: 100% 180px
      border-radius: 20px
      border: solid 1px rgba(100,100,100,0.3)
      box-shadow: 3px 3px rgba(0,0,0,0.4)