Expand entity-filter options (#10349)

* Update entity-filter.markdown

* filter should be array
This commit is contained in:
Ian Richardson 2019-09-25 13:32:54 -05:00 committed by Franck Nijhof
parent fbc7dfb14a
commit 6fded6db56

View File

@ -20,11 +20,11 @@ type:
type: string type: string
entities: entities:
required: true required: true
description: "List of entities to filter." description: A list of entity IDs or `entity` objects, see below.
type: list type: list
state_filter: state_filter:
required: true required: false
description: List of strings representing states. description: List of strings representing states or `filter` objects, see below.
type: list type: list
card: card:
required: false required: false
@ -38,6 +38,60 @@ show_empty:
default: true default: true
{% endconfiguration %} {% 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 ### Examples
Show only active switches or lights in the house Show only active switches or lights in the house
@ -67,6 +121,24 @@ card:
title: People at home 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
```
<p class='img'> <p class='img'>
<img src='/images/lovelace/lovelace_entity_filter_glance.png' alt='Entity filter combined with glance card'> <img src='/images/lovelace/lovelace_entity_filter_glance.png' alt='Entity filter combined with glance card'>
Entity filter combined with glance card. Entity filter combined with glance card.