mochman / node-red-contrib-light-transition

Node-red light transition
https://flows.nodered.org/node/node-red-contrib-light-transition
Apache License 2.0
10 stars 4 forks source link
light node-red sunrise sunset transition wakeup

Light Transition for node-red


Overview:

This node takes in a starting color and brightness and slowly changes them to meet an ending color and brightness.

This project is based on node-red-contrib-looptimer-advanced and some extra code to slowly change the brightness and color of a light over a programmable time.

This node was created to help with lights in Home Assistant that don't work with the built in transition command. The node will output a msg.payload containing:

{
  "brightness_pct": <1-100>,
  "brightness": <1-255>,
  "rgb_color": [<0-255>,<0-255>,<0-255>],
  "color_temp": <Integer>
}

that can be used with a call service node to incrementally change the color and brightness of the light.

Installation:

npm install node-red-contrib-light-transition

Configuration:

This node can be configured manually or by passing it a specific payload. The manual settings are:

The node can also be configured by sending it a specific msg.transition object:

{
  "duration": 15,                     //Total Time
  "units": "Minute",                  //Can be "Second", "Minute", or "Hour"
  "steps": 30,                        //# of steps
  "startRGB": '#ff0000',              //RGB color to start from
  "transitionRGB": '#ffff00',         //RGB color to transition through
  "endRGB": '#ffffff',                //RGB color to end at
  "startMired": 160,                  //Mired value to begin at
  "endMired": 600,                    //Mired value to end at
  "startBright": 1,                   //Starting brightness
  "endBright": 100,                   //Ending brightness
  "brightnessType": "Percent",        //Brightness values selector.  Can be "Percent" or "Integer"
  "transitionType": "Linear",         //Can be "Linear" or "Exponential"
  "colorTransitionType" : "Weighted"  //Can be "Weighted", "Half", or "None"
}

Note: Do not keep the comments in the actual msg.transition object, they are for reference only.

Any time a msg.transition is sent to the node, the settings are changed and the loop is started from the beginning again.

This node will stop running when it has reached the last step. It will send a msg.payload of complete out of the second output on the node. You can also manually stop the node by sending a msg.payload of stop or STOP. The node will end its loop and send a msg.payload of stopped out of the second output.

Localization

If you would like to help with translating, please see the locales folder for examples of what needs to be translated.

Notes

Examples

  1. If you want to configure the node without using the node options, you can send it a msg.transition object:

  1. In this example, you have one light that has both color & white light, but doesn't let you send a rgbw_color value to it.

Changelog

The change log can be found here