Light Animation Add-On

This may exist, but I haven’t found it yet.
What I’m looking for and think many people would like is an Add-On that lets people create light color animations with a web interface. It would be nice if it could call HA scenes or create custom scenes in a web UI. I use Node-Red so it’s somewhat usable this way but I’m looking for something with a color picker and a little bit more magic.

The feature set I’m looking for is about what iConnectHue does but with support for any light in HA. There’s a DIY Hue add-on, but I’m having issues even getting web based activation button to be detected by the Hue app.

Sorry if this exists but I haven’t found anything that fits the bill yet.

Hey Keith. I’ve been after this, too. I can’t offer a pretty UI, but I did write a Pyscript module that implements a HA service for long-running Philips Hue-based animations. It comes with some pre-canned color/timing schemes, but you can add more by modifying a simple JSON-like structure embedded in the script.

I use this in combination with a Lovelace widget that lets me pick the room and the color scheme and start/stop the animation. (See below.) Note that this requires the Pyscript integration, which is available in HACS.



That’s one way to handle it!

One issue is with Node-Red if I restart the container for an update or something I get knocked out of my loop.
I know I could add a input bool to check on startup maybe but it’s all so tiresome…

I’ll look at this later, like I said in our other chat if I could get something a bit more hands off going then I’d switch my bulbs over to deCONZ entirely.

The above is using the Hue integration in HA, not deCONZ.

I absolutely love your approach.
Installing pyscript and importing the script, works well.
But I’m struggling building the LoveLace and the scripts.
Maybe you could give me some help, getting this running?

Many thanks

The Lovelace widget is just a couple of input_select helpers and two scripts that call the pyscript.color_swarm_turn_on and pyscript.color_swarm_turn_off services, respectively. This is the YAML for it:

type: entities
  - entity: input_select.color_swarm_group
  - entity: input_select.color_swarm_name
  - entity: script.start_color_swarm
  - entity: script.stop_color_swarm
title: Color Swarm

The first input_select is a list of rooms/zones exactly as they appear in the Philips Hue app. The second is a list of color swarm names from the JSON file. Ideally, I’d populate both of these lists automatically, but I haven’t found a simple way to do that so I just update them manually. They don’t change very often.

The scripts are also simple. They just call the pyscript services. Here’s the start script:

service: pyscript.color_swarm_turn_on
  hue_group_name: '{{ states.input_select.color_swarm_group.state }}'
  swarm_name: '{{ states.input_select.color_swarm_name.state }}'

And the stop script:

service: pyscript.color_swarm_turn_off
  hue_group_name: '{{ states.input_select.color_swarm_group.state }}'

Note that starting a new color swarm in the same room will interrupt any previously running swarm so you don’t need to worry about conflicts. Good luck!


Thank you very much.
Everything is working great now.
I’ve added some ‘Northern Lights’ Scene to your script.

    "Northern Lights": {
        "transition_secs": 1,
        "max_hold_secs": 8,
        "palette": [
                "rgb_color": (23, 35, 71),
                "brightness": 255,
                "rgb_color": (2, 83, 133),
                "brightness": 255,
                "rgb_color": (14, 243, 197),
                "brightness": 200,
                "rgb_color": (4, 226, 183),
                "brightness": 200,
                "rgb_color": (3, 132, 152),
                "brightness": 220,
                "rgb_color": (1, 82, 104),
                "brightness": 255,

Cool! I’m gonna try this out!

This looks like a really great idea. I have been using an Android app called Hue Pro that has a GUI for achieving similar effects in the same way by setting color, length of transition, brightness etc. However you have to let the android app run which is a huge downside.

Huh that stinks it needs to be running. IConnectHue really is cool, it all runs on the Hue bridge.

1 Like

Hi there

Since I updated HA to version 2021.12.4 the color-swarm script stopped working.
I got the error in the log:
This error originated from a custom integration.

Logger: custom_components.pyscript.file.color_swarm
Source: custom_components/pyscript/
Integration: Pyscript Python scripting (documentation, issues)
First occurred: 12:20:20 PM (2 occurrences)
Last logged: 12:22:22 PM

Exception in </config/pyscript/> line 7: from aiohue.bridge import Bridge ^ ModuleNotFoundError: No module named ‘aiohue.bridge’

Do you have any idea about that?
I didn’t have any success searching for the module ‘aiohue.bridge’

Many thanks…

Kind regards and Merry Christmas

I was using the same script and ran into similar situation.
I manually installed the aiohue using the SSH & Web Terminal integration. I got it pre-compiled from
Checking the aiohue repo I saw that they changed the functions structure, so I edited my scripts to update the calls.

#from aiohue.bridge import Bridge
from aiohue import HueBridgeV2
#bridge = Bridge(host, session, username=username)
bridge = HueBridgeV2(host, session, username=username)

Finally restarting HomeAssistant made the script available again.
Hope it works for you.

1 Like

So, in the past, I tried the hass-animated-scenes integration to control a group of Wiz bulbs I have around the exterior of my house with little success.

The colorswarm idea struck me as interesting, so I modified the existing pyscript so that it should (theoretically) work with any color changing bulb.

Instead of a room_id or whatever the param was, supply the script with an “area_id” param instead, which is obv. the area id of the area containing the lights you want to control.

This should also do away with the requirement for the aiohue library, as I’ve just hacked the device registry to supply area ID’s for entities when not present, which then lets us find all entities in the light domain which have the “hs” flag in supported color modes.

Mileage may vary, but it definitly works with my Wiz bulbs, so mission accomplished on my end.

Also, added a “Halloween” swarm, as this was my main goal in getting it working in the first place. :wink:

One more time. Now I’ve added a schedule function where I can define what times of the year I want what swarms to run, and then just define a routine that starts and stops the swarms at a specific time:

Does this still work for you? I am using the first built of 2023 of HA and it seems that due to some changes related to the configuration of bridge credentials it does no longer work. Did you perform some additional adjustments?

Not that I really mind the info, but I’m not overly interested in Color Swarm.
Can we move it to it’s own topic?
Perhaps this one?

It’d be good to keep the initial explanation of what it is and what it does but it’s not really what the topic is intended for, even though it’s dead.

1 Like

Sorry, I can’t confirm anymore as I’m not using this script for a long time now.