From 6fded6db569359e2d73d9d686871825240a4a98b Mon Sep 17 00:00:00 2001 From: Ian Richardson Date: Wed, 25 Sep 2019 13:32:54 -0500 Subject: [PATCH] Expand entity-filter options (#10349) * Update entity-filter.markdown * filter should be array --- source/_lovelace/entity-filter.markdown | 78 ++++++++++++++++++++++++- 1 file changed, 75 insertions(+), 3 deletions(-) diff --git a/source/_lovelace/entity-filter.markdown b/source/_lovelace/entity-filter.markdown index 869ad2b3135..488c32f59a2 100644 --- a/source/_lovelace/entity-filter.markdown +++ b/source/_lovelace/entity-filter.markdown @@ -20,11 +20,11 @@ type: type: string entities: required: true - description: "List of entities to filter." + description: A list of entity IDs or `entity` objects, see below. type: list state_filter: - required: true - description: List of strings representing states. + required: false + description: List of strings representing states or `filter` objects, see below. type: list card: required: false @@ -38,6 +38,60 @@ show_empty: default: true {% endconfiguration %} +## Options For Entities + +If you define entities as objects instead of strings (by adding `entity:` before entity ID), you can add more customization and configurations: + +{% configuration %} +entity: + required: true + description: Home Assistant entity ID. + type: string +type: + required: false + description: "Sets a custom card type: `custom:my-custom-card`" + type: string +name: + required: false + description: Overwrites friendly name. + type: string +icon: + required: false + description: Overwrites icon or entity picture. + type: string +secondary_info: + required: false + description: "Show additional info. Values: `entity-id`, `last-changed`." + type: string +format: + required: false + description: "How the state should be formatted. Currently only used for timestamp sensors. Valid values are: `relative`, `total`, `date`, `time` and `datetime`." + type: string +state_filter: + required: false + description: List of strings representing states or `filter` objects, see below. + type: list +{% endconfiguration %} + +## Options For state_filter + +If you define state_filter as objects instead of strings (by adding `value:` before your state value), you can add more customization to your filter: + +{% configuration %} +value: + required: true + description: String representing the state. + type: string +operator: + required: false + description: Operator to use in the comparison. + type: string +attribute: + required: false + description: Attribute of the entity to use instead of the state. + type: string +{% endconfiguration %} + ### Examples Show only active switches or lights in the house @@ -67,6 +121,24 @@ card: title: People at home ``` +Specify filter for a single entity + +```yaml +type: entity-filter +state_filter: + - "on" + - operator: ">" + value: 90 +entities: + - sensor.water_leak + - sensor.outside_temp + - entity: sensor.humidity_and_temp + state_filter: + - operator: ">" + value: 50 + attribute: humidity +``` +

Entity filter combined with glance card Entity filter combined with glance card.