Sudden light extinction

Hello,

I spent 3 days on Home Assistant without success to do activities that seemed simple to me (including a light alarm clock), so I’m turning to Gladys now (with Zigbee2MQTT).

I created a scene in my hallway to turn on the lights when motion is detected, then the lights turn off automatically.

-Motion detected → lights turn on
-After X minutes without motion → lights dim
-After X minutes without motion → lights turn off

-If I move during the dimming → return to full power

-Day: higher light intensity | Night: lower light intensity

My issue:

  1. Sudden turn off: the lights turn off instantly, while the turn on and dimming are smooth. I have enabled transitions in Zigbee2MQTT/device/setting (specific)/transition: Has anyone managed to have a fade-out turn off with Hue Gu10 bulbs?

Thanks for your tips! :folded_hands:

Hello and welcome to Gladys!

Your two issues have an explanation. I’ll address them in order.

1. Sudden Shutdown

The « Turn off the lights » action in Gladys simply sends {"state": "OFF"} to zigbee2mqtt/<your bulb>/set. It’s Zigbee2MQTT that applies the transition, or not. In principle, when the transition option is set on the device, Z2M transforms this OFF into a gradual decrease to 0, then turns it off.

To find out where the problem lies, turn off the bulb directly from the Z2M interface. If it’s also instant, Gladys is not to blame: it’s between Z2M and the bulb. Then check that the transition value (in seconds) has been saved.

In any case, the most reliable way is to request the transition directly in the message: it then takes precedence over the device option. In your scene, replace « Turn off the lights » with the action « Send a Zigbee2mqtt message »:

  • Topic: zigbee2mqtt/NAME_OF_YOUR_BULB/set (the name as it appears in Z2M, including the zigbee2mqtt/ prefix)
  • Message: {"state": "OFF", "transition": 3} (3 seconds of fade)

You need one action per bulb. If your GU10s are in a Z2M group, one message to zigbee2mqtt/GROUP_NAME/set is sufficient, and they will turn off exactly at the same time. The same trick works for dimming, for example {"brightness_percent": 20, "transition": 2}.

2. The Delay That Doesn’t Restart from Zero

The scene does not resume where it left off. Each movement starts a new execution of the scene, in parallel with the one already running, and Gladys does not cancel the previous one.

I assume your scene looks like « Movement → turn on → Wait 2 min → dim → Wait 30 s → turn off ». When you move during the dimmed phase, the new execution turns the light back on. But the old one is still in its « Wait 30 s », and it turns off at the end. Moreover, 2 minutes later, the new execution will dim the brightness, which can turn the lamps back on low: setting a brightness turns on a Z2M bulb.

The solution is to stop counting time with « Wait » and let the trigger do it. The « Device State Change » trigger has an option for this: « Run the scene after the condition has been valid for: ». The timer is canceled as soon as the sensor goes back to « Motion detected », and it restarts from zero at the next « No motion ».

You should therefore split it into 3 small scenes:

Scene A – Hallway: Turn on

  • Trigger: « Device State Change » → hallway detector = Motion detected
  • Actions: your day/night logic. For example, a « If… Then… Else… » condition containing a « Temporal Condition »: Then strong brightness, Else weak brightness.

Scene B – Hallway: Dim

  • Trigger: hallway detector = No motion, checking « Run the scene after the condition has been valid for: 2 minutes »
  • Action: dim the brightness

Scene C – Hallway: Turn off

  • Trigger: hallway detector = No motion for 150 seconds (2 min + 30 s, because the two timers start at the same time)
  • Action: the Zigbee2mqtt message {"state": "OFF", "transition": 3} seen earlier

Result: if you move during the dimmed phase, scene A turns the light back on and the timers for B and C are canceled. When you stop, they restart from zero: 2 minutes at full, then 30 seconds dimmed, then fade off.

Two tips:

  • In B and C, also check « Run only when the threshold is crossed ». The timer then only starts when switching from « Motion detected » to « No motion ». If the sensor returns « No motion » later, the dimming will not be restarted, and your lamps will not turn back on low.
  • The timer only starts when the detector sends « No motion », and each detector waits a certain time before sending it. On some models, this time is adjustable in Z2M (option occupancy_timeout). The actual delay is therefore this time plus your 2 minutes: adjust accordingly.

The duration in seconds in the trigger and the Zigbee2mqtt action are available in the current version of Gladys (5.1.3): make sure to update if needed.

Keep us posted!

Thank you very much, it’s very precise! Indeed, I had used « wait ». I understand your logic when I read it.

I notice that on shutdown, the transition time indicated in M2QTT will simply indicate the delay between the shutdown command and the light turning off, rather than having a gradual light intensity decrease over the indicated transition duration.
It’s a bit mysterious:

  • If I enter « 0 » in transition, the light turns on abruptly and turns off abruptly.
  • If I put 1, the light makes a slight transition when turning on, but turns off abruptly.
  • If I put 5, the light makes the same transition as 1 when turning on, and turns off abruptly with a 5-second delay.

I confirm that even with {« state »: « OFF », « transition »: 3}, my GU10 lights turn off abruptly.
I do have an action per bulb, I haven’t made a group. Do you advise me to group my bulbs when I have two in pairs and send commands to the group rather than to each bulb separately?

Maybe I should enable Hue native control?

For the second point, I would like your opinion on a detail: during the day, after 2 minutes, it dims for 30 minutes and then turns off. But at night (in the idea), it turns on for 5 minutes, does not dim, and turns off after 5 minutes (unless motion is detected in the meantime, it restarts for 5 minutes).

For this, I tried to add a time condition in « hallway dim » and in « turn off »:

Time Condition (07:00 - 23:00)

Then: Dim light

Otherwise: empty (in the idea, « empty » would mean continue « hallway turn on »?)

And I separated the turn off scene by making one for the day (after 150 seconds), and one for the night (after 5 minutes)

Thanks for the detailed feedback, your test is very insightful!

1. Shutdown

With a transition, your GU10 waits for the duration and then cuts off abruptly. By default, Z2M simulates fade-out shutdown with a standard Zigbee command (« decrease to 0 then turn off »), and your bulbs apparently execute it in their own way.

So yes, activate Hue native control on each bulb, in the device-specific settings in Z2M. Z2M then uses the Hue-specific protocol, that of the Hue bridge, and the transition becomes a real fade duration (if the bulb supports it). Then retest {"state": "OFF", "transition": 3}.

If that doesn’t change anything, here’s a Plan B for the shutdown scene, since your brightness reductions are indeed smooth:

  1. Message {"brightness": 1, "transition": 3}
  2. Wait 3 seconds
  3. Message {"state": "OFF", "transition": 0}

For the group, this isn’t essential. Gladys doesn’t manage Z2M groups like devices: you can only control it with the « Send a Zigbee2mqtt message » action. Its advantage is a single command and two bulbs perfectly synchronized. With 2 bulbs, two messages in succession are sufficient. First set the fade on one bulb.

2. Day / Night

Your logic is good. With an empty « Else », the « Hallway Dim » scene simply stops without doing anything, and the lamps stay on as they are. It doesn’t « continue » « Hallway Lighting », which has already finished its work, but the result is the one you want. Even simpler: put the Time Condition directly as the first action, followed by the dimming. Outside the time range, the scene stops there.

Important point: each shutdown scene must have its own Time Condition as the first action. Otherwise, the « day » shutdown (150 s) also triggers at night and cuts off after 2 minutes 30 seconds:

  • Day Shutdown: No movement for 150 s → Time Condition After 07:00 / Before 23:00 → shutdown
  • Night Shutdown: No movement for 5 min → Time Condition After 23:00 / Before 07:00 (Gladys manages the midnight transition) → shutdown

The condition is checked when the timer ends, so it also works around 23:00 and 07:00. At night, a movement cancels the 5-minute timer, which restarts from zero at the next « No movement ».

PS: you wrote « dim for 30 min ». If it’s indeed 30 s, 150 s is the correct value; for 30 min, you would need to set 32 min.

Thanks! Makes sense indeed! I replaced the « If, Then, Else » statements when the « Else » is empty, as it seems to be the same as simply putting a time condition « If, Then ».

(Good catch, I wanted to write 30s, it’s corrected)

  1. When activating « Hue Native Control » on my 2 GU10 lights, I notice that the scenes do not start during the day. So for now I have deactivated it. Do I need to do something else for the scene to work once « Hue Native Control » is activated?
  2. With « Hue Native Control » deactivated, « {« state »: « OFF », « transition »: 3} » does not give me a smooth fade-out.
  3. With « Hue Native Control » deactivated, « {« brightness »: 1, « transition »: 3} » + 3s + « {« state »: « OFF », « transition »: 0} » does not give me a smooth fade-out either.
  4. If I activate « Hue Native Control », should I leave « transition: 1 » or is it no longer taken into account?
  5. Does « Hue Native Control » work well without a Hue Bridge?
  6. (Minor issue), I notice that the full power activation lasts 2 minutes 15 seconds (instead of 2 minutes), and that the dim lasts 30 seconds (perfect). Any idea to achieve exactly 2 minutes on the dot?

Scene 1: Activation

When
Input Sensor 1 (Motion Detection) - Motion Detected - nothing checked

Then
Condition « If… Then… Else… »
Time Condition
≥ 07:00 · ≤ 23:00

Then
At the same time
Control a device -
zigbee2mqtt-ceiling-input-1-light-brightness-brightness · 254
Control a device - zigbee2mqtt-ceiling-input-2-light-brightness-brightness · 254

Else

At the same time
Control a device -
zigbee2mqtt-ceiling-input-1-light-brightness-brightness · 51
Control a device - zigbee2mqtt-ceiling-input-2-light-brightness-brightness · 51

Scene 2: Dim

When
Input Sensor 1 (Motion Detection) - No Motion - Execute the scene after the condition has been valid for: 2min

Then
Time Condition
≥ 07:00 · ≤ 23:00
At the same time
Control a device -
zigbee2mqtt-ceiling-input-2-light-brightness-brightness · 26
Control a device - zigbee2mqtt-ceiling-input-1-light-brightness-brightness · 26

Scene 3: Daytime Extinction

When

Input Sensor 1 (Motion Detection) - No Motion - Execute the scene after the condition has been valid for: 150s

Then

Time Condition≥ 07:00 · ≤ 23:00

At the same time

Send a Zigbee2mqtt messagezigbee2mqtt/Ceiling Input 1/set - {« state »: « OFF », « transition »: 3}

Send a Zigbee2mqtt message - zigbee2mqtt/Ceiling Input 2/set - {« state »: « OFF », « transition »: 3}

Scene 4: Evening Extinction

When

Input Sensor 1 (Motion Detection) - No Motion - Execute the scene after the condition has been valid for: 5min

Then

Time Condition≥ 23:00 · ≤ 07:00

At the same time

Send a Zigbee2mqtt message - zigbee2mqtt/Ceiling Input 1/set - {« state »: « OFF », « transition »: 3}
Send a Zigbee2mqtt message - zigbee2mqtt/Ceiling Input 2/set - {« state »: « OFF », « transition »: 3}

Hello everyone! I still have an issue when turning off my Hue GU10 lights. I can’t get a gradual dimming effect. Does anyone have an idea?