Hi,
I want to build a sensor “sensor.problems_any” that switches to true as soon as an (any) entity enters a certain state, typically “unknown” or “unavailable”.
Thereby various entities have to be excluded (they might be on the whitelist but if a certain attribute is of a specific state the whole entity needs to be excluded).
Currently I use all this via custom card “auto-entities” in the GUI (see yaml below), but I can’t get this syntax-wise with all the distinctions into a YAML-compliant sensor definition. I´m thinking of a template sensor but I´m looking for the set of right querys.
Specific questions:
- Can I use wildcards with “is_state”?
- How can I define exclusions? So e.g. "everything with state ‘unknown’ except the attribute ‘source_type’ has the value ‘gps’ "? (so it´s a blacklist within a whitelist query)
Example what I currently use for a Lovelace card:
type: custom:auto-entities
card:
type: entities
title: ⚠ Probleme
state_color: true
show_header_toggle: false
filter:
include:
- state: unavailable
- state: unknown
not:
attributes:
source_type: gps
- domain: binary_sensor
attributes:
device_class: problem
state: 'on'
exclude:
- entity_id: group.*
- entity_id: '*geocoded_location'
- entity_id: media_player.fire_tv_4k_stick
show_empty: false
unique: true
sort:
method: name
reverse: false
Thankful for all input