Light counter

I’m a newbie to Home Assistant.

I’m now trying to make my own dashboard.

I want to add expand my mushroom chips card, besides the Weather, with a lights/switch on counter that is always visible. So it is displaying how many lights/switches there are on.

How to do this step by step?

This are the lights / switches

two lights outside:
switch.shellypro2_30c6f7812518_switch_0
switch.shellypro2_30c6f7812518_switch_1

Two lights at the living room:

switch.staan_lamp
switch.sfeerlampjes_living

I’ve found that post also. But it’s not making sense to me. Still don’t know what to add to which file.

1 Like

Added this like above to create the sensor to the configuration.yaml
And it did work.

sensor:
  - platform: template
    sensors:
      lights_on:
        friendly_name: "Lichten AAN"
        value_template: >

          {% set lights = [
          states.switch.shellypro2_30c6f7812518_switch_0,
          states.switch.shellypro2_30c6f7812518_switch_1,
          states.switch.staan_lamp,
          states.switch.sfeerlampjes_living,
          ] %}
          {{ lights | selectattr('state','eq','on') | list | count }}

Thanks!

1 Like