Skip to content

Configuration Options

Steven Rollason edited this page Oct 23, 2019 · 4 revisions

calendars (optional)

This is a list of calendar entities you want events to display for in your feed.

id_filter (optional)

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.

entities (optional)

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 default message text is in the format "entity name @ state" (but can be customized by using the content_template option, see below) and the time is the last modified time of the entity.

Each entity can be just an entity id or an entity object, allowing more customisation.

show_empty (optional, defaults to true)

Whether to show the card if there are no items to show

scrollbars_enabled (optional, defaults to true)

This controls whether the feed is scrollable. If this is set to false then, by default, all items will be displayed unless the max_height or max_item_count option is used.

max_height (optional, defaults to 28em when scrollbars enabled, otherwise unlimited)

The maximum height of the feed in CSS format (e.g. "100px", "20em", etc.). When scrollbars are disabled, the content will be cut off at this height, otherwise it will control the scrollable height.

max_item_count (optional, defaults to unlimited)

The maximum number of items to show in the feed, useful if scrollbars are disabled.

more_info_on_tap (optional, defaults to false)

When this is true, tapping/clicking and entity will display the more-info dialogue. This can be overridden for individual entities (see later).

Note: This won't work for multi-item entities. It will work for entities using the include_history option but, due to limitations of this dialogue, it will always show the latest state of the entity.

Multi-item Entities

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}}'

multiple_items (required)

This must be true to identify the entity as a multi-item entity

list_attribute (required)

The attribute on the entity which holds the list of items which should be included in the feed

timestamp_property (optional)

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.

max_items (optional, defaults to 5)

The maximum number of items to display for this entity

content_template (required)

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