Philips Hue nodes for Node-Red
An solution to control Philips Hue lights using Node-Red, uses node-hue-api library for communicating with the lights.
This module provides input and output nodes for communicating with Philips Hue lights, the input node accepts multiple color format and automatically converts the values to the right format.
- Control both groups and individual lights.
- Handles automatic conversion of rgb/hsv/hex/xy/.. color space to light specific color space
- Trigger events for light changes
- Self syncing, uses background polling to detect external changes to light
- Displays current state for light in the Node-Red ui
- The HSV to XY (and back) color conversion is not 100% correct, modifying single color channel at a time can produce strange results.
Dashboard example config:
This is an example of how to control the light using the node-red-dashboard
The split node is used to get the
bri payload from the light status message, and the join is used to combine the topic and value to an JSON object.
Wakeup example config:
Simple example of using an inject node to trigger an wakeup light behavior every workday, the light transitions from off to on with 75% brightness over an duration of 30s.
The light is controlled by sending message with an payload containing the new state
Simplified control by sending the following values as payload
||Turn light on|
||Turn light off|
|numeric value||Turn light on and set brightness (0-100%)|
More advanced way to control the light is to send an object payload with one or more of the following properties set
||Set light state (true/false)|
||Set one or more color channel for light (0-255)|
||Set color (#f49242)|
||Set color hue (0-360)|
||Set XY color (array with 0.0-1.0 values)|
||Set XY color (0.0-1.0)|
||Set color saturation (0-100)|
||Set light brightness (0-100%)|
||Set Mired color temperature (153 - 500)|
||Set kelvin color temperature (2200-6500)|
||Transition time (ms)|
||Alert effect ('none', 'select' or 'lselect')|
||Dynamic effect ('none' or 'colorloop')|
Example: Sending the following to the light will turn it on and dim it upp to 77% over 10 seconds
Example output from change event
Using withouth Node-RED
The MQTT topic
lights will contain an list of all currently detected lights.
Specific light can be controlled by sending an message to the topics
lights/<id>/on (boolean) or
lights/<id>/brightness (number) with the new state.