My overcomplicated light flows!

I just finished to configure my lights automations related to the actions I can trigger using my remotes and I’d like to share it with you!

First of all, for now I covered 4 rooms:

The living room is the only one with Hue color bulbs, the rest is IKEA Tradfri with white spectrum (yellow/white).

3 of the 4 rooms have IKEA Tradfri remotes I use to control them. The living room doesn’t have one because the one of the kitchen is close enough to be shared (and because I still have to buy more :smiling_imp:)

Here’s the main Node-RED flow:

The event filter node is a simple filter to grab only the actions triggered by my remotes (marked as deconz_event). Then I check which remote is being controlled, set 3 msg.* properties (each remote controls 3 rooms with the middle, left, and right buttons), and then we move into the Remote Controls subflow:

Here we identify which buttons are being pressed on the remote, and which kind of press is being triggered (short, long, hold).

If the press is short, and the pressed button is the left, right, or middle, I toggle the lights of the relative room.
The toggle command is a custom one (more later).
If the button pressed is up, or down, I brighten or darken the lights of the main room (the one assigned to the middle button).

If the press is long, and the button is left/right/middle, I check which room is being targeted, and trigger a Flux update to set the temperature to the right one according to the time of the day.
If the press is long, and the button is top/down, I set brightness to max or min on the main room.

Now, coming back to the custom toggle subflow, here it is:

What it does is: if the light is turned off, turn it on and then adjust the temperature using Flux.
If the light is turned on, it simply turns it off.

So far this is all I needed to do for my remotes to work as I wanted! I really like Node-RED and I’m sure I’ll do much more with it! (I already have a “movie time” flow that turns on the TV, opens Plex on my SHIELD TV and sets the lights to a given brightness (waiting for Ambilight+Hue to take control of them short after)).


Quick update, I changed the “Flux Toggle” subflow to be more efficient, because previously it would take quite some time to properly finish the “on” action, since I first had to turn on the light an then let Flux update the color.

Now I installed redshift on the host machine, and I call it to get the proper temperature in kelvin, that then I use to directly set the temp of the light in the light.turn_on action, now it’s way quicker!

Hey thanks for sharing

would it be possible to share the json of the flows as well ?

would be easier to grasp how things have been done. Image is good , but when we can import and play with it it’s even easier :slight_smile:

I’ll do! I fear to accidentally expose my Hass credentials while I copy tho :face_with_hand_over_mouth:

edit, here’s the flow:

Thanks for sharing !!

1 Like