HI,
for a marquee in the Custom Header, I’d like to have a couple of signaling sensors to be displayed on a single line. I have all the ingredients and conditions, but am a bit confused how to group this in 1 single larger set of templates.
Have an example how to do this, but it is built on a single integration, which I don’t have, mine should be built on individual sensors.
the example is made by @ludeeus here in the Custom Header showcase thread :
{% set alerts = namespace(active=[], color='var(--google-red-500)') %}
{% if states('sensor.weatheralerts') | float != 0 %}
{% for alert in state_attr('sensor.weatheralerts', 'alerts') %}
{% set alerts.active = alerts.active + [alert['title']] %}
{% endfor %}
{% else %} {% set alerts.active = alerts.active + ['No active alerts'] %}
{% endif %}
and the marquee then uses:
<span style='color: {{ alerts.color }};'>
Alerts: {{ alerts.active | join(' - ')}},
</span>
so far so good. My sensors would be based on:
binary_sensor.alert:
value_template: >
{{ is_state('binary_sensor.schimmel_alert','on') or
is_state('binary_sensor.meteoalarm_brabant','on') or
is_state('persistent_notification.updater_notification','notifying') or
is_state('persistent_notification.trash_notification','notifying')}}
being on, and then I’d need to display these values for each contributing sensor above:
Schimmel alert: {{ states('sensor.schimmel_sensor')|float}}
MeteoAlarm: {{state_attr('binary_sensor.meteoalarm_brabant','awareness_level')} - {{state_attr('binary_sensor.meteoalarm_brabant','awareness_type')}}
Update {{ states('sensor.ha_available_version') }} available
Trash-alert: {% if states('sensor.trash_firstdate') == 'vandaag' %} {{states('sensor.trash_today')|title}} wordt vandaag opgehaald!
{% else %} {{states('sensor.trash_tomorrow')|title}} wordt morgen opgehaald!
{% endif %}
Please have a look if yo can help me build this, thanks!
for the time being I now have this, but it obviously stops right after the first met condition and wouldn’t use the consecutive conditions if they where met…
{% if is_state('binary_sensor.alerts','on') %}
{% if is_state('binary_sensor.schimmel_alert','on') %} Schimmel alert: {{ states('sensor.schimmel_sensor')|float}} - Ventilate! %
{% elif is_state('binary_sensor.meteoalarm_brabant','on') %} MeteoAlarm: {{state_attr('binary_sensor.meteoalarm_brabant','awareness_level')}}{{state_attr('binary_sensor.meteoalarm_brabant','awareness_type')}}
{% elif is_state('persistent_notification.updater_notification','notifying')%} Update: {{ states('sensor.ha_available_version') }} available
{% elif is_state('persistent_notification.trash_notification','notifying')%}
{% if states('sensor.trash_firstdate') == 'vandaag' %} Afval: {{states('sensor.trash_today')|title}} wordt vandaag opgehaald!
{% else %} {{states('sensor.trash_tomorrow')|title}} wordt morgen opgehaald!
{% endif %}
{% endif%}
{% else %} No Alerts
{% endif %}
@petro and @123 might I ask you to have a quick glance here? Hope you can help me out.