If you have Home assistant running with node-red and you have philips hue stuff in your house; you may think it can react slow sometimes. We can fix this very easily by installing the node-red hue magic package.
Installing node-red hue magic
To install hue magic you need to go to your node-red dashboard. head to the hamburger menu and press manage palette.
from there press the install tab, type hue, search for hue magic and press install
After you installed the hue magic palette you will see the nodes at your left hand (when you scroll down) they will look something like:
Using hue magic
Using hue magic is fairy easy. To start you need to add the hue bridge node
After you added the bridge to your flow double click to edit.
After you pressed the pen (2.) the following will pop-up
Be close to your bridge because we need to press it soon. But first press the magnifying glass (1.) select your bridge then press the person (2.). You’ll need to press the button on your hue bridge. After that your bridge is added.
Hue switch
I like to use my hue switch to turn on my shelly smart switch. within home assistant you can make it easy to switch, but it has this delay on it. That isn’t the case with Hue magic. To use your switch do the following.
Add a hue switch node to your flow and edit it.
Since you’ve added your bridge it will be filled automatically (I removed mine). select your switch and press done.
Next you want to use the button, but you don’t know the actions it sends when you press a button. Add a debug node to your flow and double click it.
Select all three check boxes and press done.
Press the button on your hue switch and the values will show below your node.
Open debug menu (hamburger top right corner > view > show sidebar), press the object arrow to expand. Copy path
Add a regular switch node and edit it.
Paste the path you copied in the property field. Add multiple values for turn on, off and brightness if you like. Be sure to match it from the “Name:” value, otherwise it won’t work.
Now you need to add the call service node to add actions to your switch and you’re done.
Hue motion sensor
The hue motion sensor works kind of the same as the switch for the adding part. You need to add the hue motion node to your flow and edit it.
Select your sensor like you did with the switch and press done.
Now add your actions in the flow and it will work when motion is detected.
Above sample flow I use will work even without the light level in between. You only need to add the output of motion sensor to the input of turn on (lamp aan in my sample).
Conclusion
This concludes this tutorial. it’s really easy to achieve this once you know the steps. you can now start creating more difficult flows and go nuts with it. For example using presence detection, which you can find more about here. These are the most common use cases I have. If you’d like to have more samples or an extended tutorial on this let me know down in the comments.
Hi Dennis,
Could you explain what the ‘motion’ node is in the flow shown? As best as I can tell this could only be the binary_sensor created in HA for the hue motion sensor?
Which seems odd – i.e. that you are using both Node-Red and HA control over the sensor.
I (and it sems many people) have an issue where the sensor won’t cause any reaction to movement for a period of time just after the lights go out, so your flow is of interest to me if you don’t have that problem (and hence me wanting to know about that ‘motion’ node).
Many thanks,
Ian
Hi Ian,
The ‘motion’ node is nothing more than a check whenever the motion still is happening.
I understand that it may seem off because the “double use”, but it’s actually the power of node-red in my opinion.
The node motion has a huge time-out against the philips hue node even if it’s 1 second which is huge for a motion sensor.
The first trigger by philips node the second one by home assistant, you could even use a second hue node but I havent checked that. Works really well for my clothing room.
If you have further questions, let me know.
Cheers,
Dennis