gadgetchnnel / lovelace-home-feed-card

A custom Lovelace card for displaying a combination of persistent notifications, calendar events, and entities in the style of a feed.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

timestamp_property for single-item entities

Syntoxr opened this issue · comments

Hi,
I think it would be handy to be able to use the timestamp_property in single-item entities because:

  • you could manipulate the displayed elapsed time
  • the elapsed time doesn't reset on HA reboot

I already achieved this by using the multi-item entity with only one entry and a sensor which attributes are formatted correctly, but this is a rather complicated way.

So, if you have a bit of spare time and want to add this, I would be happy.
Thank you for your work so far 👍

I already achieved this by using the multi-item entity with only one entry and a sensor which attributes are formatted correctly, but this is a rather complicated way. // HOW?

@kiloptero

card config:

  - entity: sensor.notify_window
    multiple_items: true
    list_attribute: attributes
    timestamp_property: created
    max_items: 5
    content_template: '{{message}}'

Sensor attributes:

attributes:
 - message: The upstairs bathroom window is closed again
   created: "2024-05-14T01:06:00"
icon: mdi:border-all
friendly_name: notify-window

The sensor is created and updated via Node-Red:

function node for formatting:

const message = "The upstairs bathroom window is closed again";

msg = {
  "message":message,
  "payload":{
    "attributes":{
      "attributes": [
        {
          "message": message,
          "created": global.get("time_iso")
        }
      ]
    }
  }
}

return msg;