Lights switch randomizer to even-out usage of two separate light switches in the same room

Hi All,

Wanted to seek ideas for best implementation ideas for the following scenario:

I have two separate dimmers in the living room each controlling a set of 5 lights. I tend to always use the same one, leaving the other one unused, which will cause one set of bulbs to wear out sooner than the other. I have one of the lights called : Lights and the other Lights 1 , so I always ask Siri to “turn on the living room Lights” , it switches on the one called lights :slight_smile:

What I want is automation which will randomly select one of these two lights and turn one of them on…
The complicatoin arrises when you will want to say “set lights to 50%”. At that point we actually need to find the lights that were randomly selected previosly and dim those.
Also need to look up which of the lights is on to turn them off.

What is the best way to accomplish this?

Regards,

-D.

You could possibly use a switch, off is for one set of lights and on for the other set that way they are used evenly, if you wanted to use siri to control them you could also make another virtual switch for those lights and that way when the virtual switch is toggled it will check what state the first switch is in to decide which set of lights to turn on.

Here is my simple solution with two scripts that are called from various automations.

I have not yet done integration with Siri. I still now need to tell Siri specifically which light of the two to dim as HA exposes those “light.xxx” objects to HomeKit automatically and both lights are named differently in HomeKit.

Any advise on how to best do it? ask Siri to set lights brightness to x%, should trigger a script which would find a light that is “ON” and dim it. Not sure how to expose both “light.living_room_ceiling_light_1_level” and “light.living_room_ceiling_light_2_level” from HomeKit in the context of the scenario I just described.

living_room_lights_on:
  sequence:
   - service: homeassistant.turn_on
     data_template:
       entity_id: >

        {%- if is_state('light.living_room_ceiling_light_1_level','on') -%}
            light.living_room_ceiling_light_1_level
         {%- elif is_state("light.living_room_ceiling_light_2_level", "on") -%}
            light.living_room_ceiling_light_2_level
          {%- else -%}
          {{ [
           "light.living_room_ceiling_light_1_level",
           "light.living_room_ceiling_light_2_level"
            ] | random }}
          {%- endif -%}
    

 living_room_lights_off:
      sequence:
       - service: homeassistant.turn_off
         data:
           entity_id: light.living_room_ceiling_light_1_level
       - service: homeassistant.turn_off
         data:
           entity_id: light.living_room_ceiling_light_2_level

You could combine the above with a history stats sensor to try and equal out on time.

1 Like

Very interesting… Will investigate. Thank you.

A template light might work as well that way it is only shown to HomeKit as one light.

1 Like