# Home Assistant light transitions

**URL:** <https://discourse.nodered.org/t/home-assistant-light-transitions/87083>\
**Category:** General\
**Tags:** home-assistant\
**Created:** [8 April 2024 15:59 UTC](https://discourse.nodered.org/t/home-assistant-light-transitions/87083 "2024-04-08T15:59:24Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![killingerr](https://avatars.discourse-cdn.com/v4/letter/k/7cd45c/32.png) [@killingerr](https://discourse.nodered.org/u/killingerr)\
**Post date:** [8 April 2024 15:59 UTC](https://discourse.nodered.org/t/home-assistant-light-transitions/87083/1 "2024-04-08T15:59:24Z")

</div>

So I am trying to transition light colors over a period of time and I'm not quite sure what would be the best way to do this. I was looking into [this](https://flows.nodered.org/node/node-red-con) but I can seem to find a good example of it in use. Any advice or guidance would be helpful/

---

<div class="post-metadata">

**Author:** ![jbudd](https://avatars.discourse-cdn.com/v4/letter/j/5f8ce5/32.png) [@jbudd](https://discourse.nodered.org/u/jbudd)\
**Post date:** [8 April 2024 16:26 UTC](https://discourse.nodered.org/t/home-assistant-light-transitions/87083/2 "2024-04-08T16:26:53Z")

</div>

How much have you achieved so far?

Can you turn your light on/off from home Assistant?  
Can you set a light to a single colour?  
What kind of smart light is it?  
Does [this tutorial](https://www.youtube.com/watch?v=IPL2EPeZ3o8) work for you?

---

<div class="post-metadata">

**Author:** ![athome](https://avatars.discourse-cdn.com/v4/letter/a/b77776/32.png) [@athome](https://discourse.nodered.org/u/athome)\
**Post date:** [10 April 2024 05:54 UTC](https://discourse.nodered.org/t/home-assistant-light-transitions/87083/3 "2024-04-10T05:54:28Z")

</div>

killingerr,

The [node-red-contrib-schedex node](https://flows.nodered.org/node/node-red-contrib-schedex) might satisfy your use case.

Here is an example of one way to use it. _See the link provided above for a complete list of "named" times that are supported by the schedex node. Specific time (i.e. 23:15) may also be used to trigger an event in the schedex node._

I have a light by the carport door that comes on with 100% brightness at sunset (sunset: sun disappears below the horizon, evening civil twilight starts). At Night (night starts when it is dark enough for astronomical observations), the light dims to 50%. One hour after Night, the light goes to 10%. At Nautical Dawn (nautical dusk: evening astronomical twilight starts), the light turns off. There are four sequences, each triggered by a schedex node, in my Lights flow that implement the four events.

A schedex node supports both on and off events. The node also has payload properties for on and off events. This makes it very easy to trigger an event in home assistant because the schedex payload can carry all of the information required to call the home assistant **call service** node (i.e. msg.payload.data.entity\_id, msg.payload.data.value, msg.domain, msg.service, etc.).

Maybe what you are trying to do is transition the color of some LED lights in your house. You could try this.

Use a boolean in home assistant (i.e. input\_boolean.ledLights) to trigger a node-red sequence that would turn the lights on and cycle through LED color changes.

The sequence will:  
0) turn on the lights

1. Set the LED color
2. start a delay using the time value specified in the delay node
3. loop back to #1

This will be an infinite loop that will run until the value of input\_boolean.ledLights changes to false.

Create a second node-red sequence that will trigger when the state of input\_boolean.ledLights changes to false. This sequence will send msg.reset to the delay node, which will cancel the delay and turn off the lights.

If you want to get fancy, you could have an input\_number.ledColorDuration in home assistant that you could use to set the duration of the delay. Modify the loop to get the duration before starting the delay.

The sequence would change to:  
0) turn on the lights

1. Set the LED color
2. get the color duration
3. start a delay using the msg.delay value that is set from the payload in #2 above. **NOTE:** from the delay help: msg.delay sets the delay, **in milliseconds** , to be applied to the message. This option only applies if the node is configured to allow the message to override the configured default delay interval. There are 60,000 milliseconds in a minute. You may need to do some math using 60,000 and the value that is in input\_number.ledColorDuration to avoid having to enter really big numbers in home assistant (i.e. if the value in input\_number.ledColorDuration is minutes, that value will have to be multiplied by 60,000 to set the value of msg.delay that goes to the delay node.).
4. loop back to #1

If you want to get super fancy, you could use a node-red sequence with a schedex node to turn on and turn off input\_boolean.ledLights so that the entire process needs not human interaction.

Hope this is helpful.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [9 July 2024 05:54 UTC](https://discourse.nodered.org/t/home-assistant-light-transitions/87083/4 "2024-07-09T05:54:38Z")

</div>

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.
