Hello, I hope you can help me, I would like to know how to create a sensor that tells me how many light bulbs or devices are on. I have managed to do that but I would like to know which devices are on.
- platform: template
sensors:
current_enchufes_importantes_on:
friendly_name: Enchufes Importantes ON
icon_template: mdi:lightning-bolt-outline
unit_of_measurement: 'on'
value_template: >
{% set total = 0 %}
{% if is_state('switch.ventilador', 'on') %}
{% set total = total + 1 %}
{% endif %}
{% if is_state('switch.calefactor_bano', 'on') %}
{% set total = total + 1 %}
{% endif %}
{% if is_state('switch.monitor', 'on') %}
{% set total = total + 1 %}
{% endif %}
{% if is_state('switch.monitor_dos', 'on') %}
{% set total = total + 1 %}
{% endif %}
{% if is_state('switch.grave', 'on') %}
{% set total = total + 1 %}
{% endif %}
{% if is_state('switch.tele_dos', 'on') %}
{% set total = total + 1 %}
{% endif %}
{{total}}