Interesting Light Behavior with Node Red

Maybe someone can help explain this behavior.

I have 5 light bulbs in a lamp (zigbee rgb) and behind it is a govee floor lamp.

Both lamps are behind the couch so I’m attempting to have a zigbee button turn both lamps on and off

Inside of HA I have a group where that contains the 5 bulbs.

I’m using Node Red to do my automation.

Here is a screenshot of the automation.

The issue lies if the floor lamp not synced together (one light is on and the other is off).

When the automation runs, the group of 5 lights flash then the automation completes like all the lights are linked together somehow (outside of the automation)

Any idea why this is happening? I can make a video of this happening if anyone wants to see.

The latest run was on Timestamp 13:51.

The 5 lights was turned on to start
Ran the automation
5 lights flash then floor lamp turns on
All lights are now on

Expected behavior
5 lights turn off
Floor lights turn on

I am confused, can you explain it another way. Or a video may help.

So you have 5 light (bulbs?) in one lamp?
Each is a smart bulb?
And you have them combined into a group in HA?

And what is “check ambient light state”, checking? The floor lamp, natural sunlight? If its checking the floor lamp state, that may be your issue. Because then at the same time, it is checking the floor lamp to determine if it should turn the floor lamp on or off, but then you are also using the state of the floor lamp to determine if the 5 bulbs should turn on or off.

And your issue happens when the FLOOR lamp is not in the same state as the 5 bulbs in the lamp? Or is it when the 5 bulbs in the lamp arent all in the same state?

If your goal is to always have the overhang lights and floor lamp be in opposite state, and want the button to control it, why not something like below?

I will provide a video. But to answer some of your questions.

5 smart bulb 1 lamp
yes grouped in HA

Don’t read too much into the labels. That was the minimum amount of work to get the behavior to trigger. This was really part of a larger automation I was working on until I saw this error.

The “ambient light state” label was actually wrong and is checking the group of lights if they are on an off.

To explain everything in full. I have a zigbee button that has 3 states. single click, long press, double click.

Single click should turn the 5 light lamp and the floor lamp on and off depending on its state.

Long press should turn off either the floor lamp or the 5 light lamp depending what is currently on. For example if 1 long press is registered and both lights are on, turn the lamp off. Long press it again, turn the lamp off and turn on the 5 light lamp. Once more, turn off 5 light lamp, turn on floor lamp.

Double click (which I havent even tried yet), cycle though predefined colors.

What you’re seeing right now is a dumbed down single click. The signal comes in and the state of each lamp is checked. If the 5 light group is on, turn it off. If its off, turn it on. Same with the floor lamp. If its off turn it on. If its on turn it off.

The issue that I’ve found during testing is when the lights are out of sync (which will happen when I want to do a long press of the button). Even though each lamp is independent of the other, they will want to act synced.

So lets say we’re simulating what should happen if the lights are out of sync. The 5 light lamp is on and the floor light is off. With the automation, the signal comes in and if its correct, the 5 light lamp should turn off while the floor lamp turns on.

Instead of doing that. The 5 light lamp instead flashes (instead of turning off) and the floor light comes on, putting them back into a synced state (and incorrect). If the automation is ran again, the lights will proceed on and off properly

I figured it out. In my “call service” nodes, I had the area where the lights were located selected. In fact that field should have been left blank.