Hello,
I would like to put an titel on my dashboard, but only if one of many entities is on.
At the moment I have it with the following code:
type: custom:mushroom-title-card
title: |-
{% set x = expand(
'binary_sensor.flur_bewegungssensor_motion', 'binary_sensor.bad_bewegungssensor_motion', 'binary_sensor.kuche_bewegunssensor_motion', 'binary_sensor.schlafzimmer_bewegungssensor_motion', 'binary_sensor.homematicip_bewegungsmelder_innen'
)
| selectattr('state', 'eq', 'on')
| map(attribute='name') | list %}
{{ 'Bewegung' if x | length > 0 else '' }}
The text “Bewegung” only displayed if one of the entities is on. That works. But if no entity is on, I get a placeholder displayed:
What code do I have to use so that the entire line is not displayed?