From c6b84de30fa00ab900f3493f24e05e1fde571246 Mon Sep 17 00:00:00 2001 From: Ian Richardson Date: Thu, 12 Sep 2019 00:42:58 -0500 Subject: [PATCH 1/2] Update entity-filter.markdown --- 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 869ad2b31356..d6f2b53059b3 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. From aa590b332c60195de47fcc8d608cc04c853161d9 Mon Sep 17 00:00:00 2001 From: Ian Richardson Date: Sat, 21 Sep 2019 17:24:42 -0500 Subject: [PATCH 2/2] filter should be array --- source/_lovelace/entity-filter.markdown | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/source/_lovelace/entity-filter.markdown b/source/_lovelace/entity-filter.markdown index d6f2b53059b3..488c32f59a29 100644 --- a/source/_lovelace/entity-filter.markdown +++ b/source/_lovelace/entity-filter.markdown @@ -134,9 +134,9 @@ entities: - sensor.outside_temp - entity: sensor.humidity_and_temp state_filter: - operator: ">" - value: 50 - attribute: humidity + - operator: ">" + value: 50 + attribute: humidity ```