Controlling Lights, blinking and effects failures and issues

Hey folks,

I’ve been trying to create some light effect sequences on my home of 50+ hue lights installed… Here are my experiences, failures, issues and cry for help:

Problem 1: Lag and sync - solved.

First, I had a lot of lag issues when trying to address the lights either individually or as a HA-group of lights. It just didn’t work as I assume behind the scenes HA tried to perform 50 requests for each individual light to the HUE hub resulting in major lagging and desync.

I also got some weird errors of timeout, which resolved themselves after I followed advice from past posts in this forum to uninstall and re-install the Hue integration, so that got settled.

The solution to the lag problem was to create a “Zone” on the hue application, which then got propagated to HA through the Hue integration so I now have a single entity addressing all the house lights. This sped up things a lot.

I’d love to not have that “development zone” in my Hue app, but I can live with it if that proves to be a physical barrier to being to control all my home lights in sync.

Problem 2: Creating a blinking script manually

I tried to perform the most simple of light effects have them blink.

I’ve seen multiple approaches to the subject, especially around the looping of the blink, considering my use case, what made more sense was to create a script that kept on blinking the lights as long as a binary_input entity was on, so here it is:

hue_bright_breath:
  alias: HUE Bright Breath
  description: Will blink all home lights
  mode: restart
  icon: mdi:lightbulb-on-outline
  sequence:
    # First action is to turn on the lights and set their color and brightness
    - service: light.turn_on
      data:
        brightness: 255
        rgb_color:
          - 255
          - 255
          - 255
        transition: 0
      target:
        entity_id: light.all_home
    # Then repeat the blinking only adjusting the brightness...
    - repeat:
        while:
          - condition: state
            entity_id: input_boolean.hue_effect_active
            state: "on"
        sequence:
          - service: light.turn_on
            data:
              brightness: 255
              transition: 0.7
            target:
              entity_id: light.all_home
          - service: light.turn_on
            data:
              brightness: 50
              transition: 0.7
            target:
              entity_id: light.all_home

I came to this implementation after many iterations, here are the pros and cons:

Pros

  • Will blink all lights in sync
  • Will stop fairly accurately (as soon as the loop completes) when I turn off the input_boolean

Cons (read issues)

  • The blink cycle is not exact, there can be lag between the blinking states that doesn’t result in a smooth blinking experience.

Problem 3: Blinking the lights using “flash”

There is a “flash” data attribute when using the lights service that’s supposed to have the lights blink, here’s a simple example of the light.turn_on service:

service: light.turn_on
data:
  flash: short
target:
  entity_id: light.all_home

The problem with this is that the lights will not blink in sync, they will blink in sequence… so one light will blink, then another, then another… which makes no sense and I don’t know how to work around…

Then, there’s the “flash: long” version of the above script… This setting works as expected! All lights flash in sync and in perfect timing, they flash 15 times and stop. To my knowledge, I cannot stop the sequence of the 15 blinks, so it’s all or nothing…

Recap of problems and help I need

I would like to have a blink of all my 50+ lights that:

  • Is in complete sync between all the lights (as with “flash: long” and my script)
  • Does not lag between the blinks (as with “flash: long”)
  • I can control when to stop (as with my script)
  • I can configure the light’s brightness and color to blink to (as with “flash: long” and my script)

As you can see I can get some of what I need with one solution and some with another, but not all with a single solution.

I’ve read the entire thread by @denilsonsa: WTH is so difficult to make a light blink for a couple of seconds? - which puts the spotlight on how challenging it is to make lights blink…

The above problem is just a stepping stone to what I want to be implementing like active scenes constructed in HA to perform visual effects on lights that are outside my home as well as visual notifications based on events, but before i get into that, I need to have a reliable and robust way to accurately control my lights, in sync and without lag.

Has anyone with a similar setup (plenty of hue lights) tried to tackle this problem?

Sidenote: I am open to achieving my goals through any means, not necessarily by brute-forcing it via HA… for instance I’d be happy if I could create a Philips Labs Formula with my desired effect and be able to call that formula form HA…

So two additional questions:

  • Can HA call a Philips Labs Formula? (how)
  • Does anyone know if we can create our own Formulas or are they a closed ecosystem of philips?