A custom Lovelace card for displaying a combination of persistent notifications, calendar events, and entities in the style of a feed.
You can install this manually or use custom_updater if you want easy updating,
Download all files and place them in the folder www/custom-lovelace/home-feed-card under your Home Assistant config folder.
Reference the file under resources like this:
resources:
- url: /local/custom-lovelace/home-feed-card/lovelace-home-feed-card.js?v=0.0.0
type: js
resources:
- url: /customcards/github/gadgetchnnel/lovelace-home-feed-card.js?track=true
type: js
Alternatively, you can add https://raw.githubusercontent.com/gadgetchnnel/lovelace-home-feed-card/master/custom_card.json to the card_urls in custom_updater if you want to do it that way.
Version 0.2.4 uses dynamic module imports to import the Moment module. Firefox versions < 66 don't support these by default and you may need to set the javascript.options.dynamicImport
option in about:config
for it to work.
type: 'custom:home-feed-card'
title: Home Feed
show_empty: false
calendars:
- calendar.home_calendar
- calendar.work_calendar
id_filter: ^home_feed_.*
entities:
- sensor.next_alarm_time
- entity: sensor.bin_collection
name: Next Bin Collection
- entity: sensor.reddit_help
multiple_items: true
list_attribute: posts
timestamp_property: created_
max_items: 5
content_template: '[{{title}}]({{url}})'
This is a list of calendar entities you want events to display for in your feed.
This is a regular expression for filtering persistent notifications by notification id. In the example above, "^home_feed_.*" will result in only notifications with ids starting with home_feed_ from being displayed.
A list of entities to display on the feed. These can be displayed as single items, or multiple items from a sensor attribute (see the section on multi-item entities). Single item entities are displayed as follows:
- For sensors with a device_class of "timestamp" the message text is the entity name and the time is the state of the sensor.
- For other single-valued entities the message text is in the format "entity name @ state" and the time is the last modified time of the entity.
Whether to show the card if there are no items to show
Entities can made to appear as multiple items in your feed if they contain a list of objects as an attribute. For example, the Reddit sensor has attributes like this:
{
"posts": [
{
"title": "Post title",
"created": 0000000000,
"body": "Post body!",
"score": 00,
"comms_num": 00,
"url": "https://www.reddit.com/r/*****",
"id": "******"
},
{
"title": "Another Post title",
"created": 0000000000,
"body": "Another Post body!",
"score": 00,
"comms_num": 00,
"url": "https://www.reddit.com/r/*****",
"id": "******"
}]
}
To add multi-item entities for this the following format would be used:
type: 'custom:home-feed-card'
title: Home Feed
show_empty: false
calendars:
- calendar.home_calendar
- calendar.work_calendar
id_filter: ^home_feed_.*
entities:
- entity: sensor.reddit_<name>
multiple_items: true
list_attribute: posts
timestamp_property: created
max_items: 5
content_template: '{{title}}'
This must be true to identify the entity as a multi-item entity
The attribute on the entity which holds the list of items which should be included in the feed
The property on the object which has the posted time. The property can be either a string in ISO format or a Unix timestamp. If this is not supplied, the modified timestamp of the entity is used.
The maximum number of items to display for this entity
This controls the message text which is displayed for each item. Any property on the object can be included as part of the text by using the format {{propertyname}}
Basic example, template generating text:
'{{title}}' -> 'Post title'
Advanced example, template generating Markdown:
'[{{title}}]({{url}})' -> "[Post title](https://www.reddit.com/r/...)" This would be rendered as Post title