Node-Red Flow Samples/Sharing

This might be useful to anyone looking to replicate a "wait until" flow. The first inject node set the flow context to First and starts the timeout timer. The second inject node is passed through if sent before the timeout and resets the flow context to "none"

@Royski

As a way to streamline your dummy Alexa Routines that you have to do, my brother pointed this out for Alexa:

It seems that you could create a bunch of different phrases that you use and just tell Alexa to respond with "ok". I haven't played with it yet but I hope that it would eliminate a bunch of dummy routines that just wait. My brother got to 50 "questions" and it was still going strong.

I haven't had a chance to play with it but I think it would streamline both of our setups.

3 Likes

Oh man this is awesome!! Not only that, but I like that you can add more ways to say the same thing :smiley: A shame you cant respond with Brian's voice, I kind of like the "Jarvis" replies lol. Fantastic tip, many thanks for this!! :+1:

Evidently you are limited to 4 variations of saying one "question" but that still should work well.

1 Like

How many ways do you need to say "Turn the ■■■■■■■ lights on" hahahaha. :stuck_out_tongue:

I think I mentioned in my original post about this but I use at least 3.

  • Illuminate (from The Demolition Man)
  • Lumos Maxima (from Harry Potter)
  • Turn the Lights on
1 Like

I got tired of trying to figure out every permutation that someone might use and putting them into blueprints so I just stuck an extra Alexa speaks at the end with her saying "OK, got it boss". So she interrupts herself, which is pretty funny

Me: Alexa, turn on bathroom lights
Correct bathroom lights turn on
Alexa: A few things share the name bathroom li... OK, got it boss

2 Likes

can you post the code for this example? i’ve been using the join-wait node, which works pretty well.

thanks

Sure

[{"id":"d08e5ad8.f69718","type":"tab","label":"Flow 1","disabled":false,"info":""},{"id":"b853fcba.9df86","type":"inject","z":"d08e5ad8.f69718","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"First","payloadType":"str","x":230,"y":220,"wires":[["b9f3c3d.a2f894"]]},{"id":"bf9251ae.dff4c","type":"change","z":"d08e5ad8.f69718","name":"","rules":[{"t":"set","p":"First","pt":"flow","to":"First","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":910,"y":160,"wires":[[]]},{"id":"d3c837a8.3f6aa8","type":"inject","z":"d08e5ad8.f69718","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"Second","payloadType":"str","x":230,"y":300,"wires":[["c502e0c6.4876e"]]},{"id":"8c3bcbc1.36fbe8","type":"change","z":"d08e5ad8.f69718","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"Done","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":900,"y":340,"wires":[["78a77ab8.4013a4"]]},{"id":"2a3fc4ec.6deeec","type":"change","z":"d08e5ad8.f69718","name":"","rules":[{"t":"set","p":"First","pt":"flow","to":"none","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1130,"y":240,"wires":[[]]},{"id":"c502e0c6.4876e","type":"switch","z":"d08e5ad8.f69718","name":"","property":"First","propertyType":"flow","rules":[{"t":"eq","v":"First","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":450,"y":300,"wires":[["a60279a1.ef4aa8","b3ca04ba.3ae468","8c3bcbc1.36fbe8"]]},{"id":"b3ca04ba.3ae468","type":"delay","z":"d08e5ad8.f69718","name":"","pauseType":"delay","timeout":"10","timeoutUnits":"milliseconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":890,"y":280,"wires":[["2a3fc4ec.6deeec"]]},{"id":"a60279a1.ef4aa8","type":"trigger","z":"d08e5ad8.f69718","name":"","op1":"","op2":"1","op1type":"nul","op2type":"str","duration":"2","extend":false,"overrideDelay":false,"units":"s","reset":"","bytopic":"all","topic":"topic","outputs":2,"x":880,"y":220,"wires":[[],["2a3fc4ec.6deeec"]]},{"id":"b9f3c3d.a2f894","type":"switch","z":"d08e5ad8.f69718","name":"","property":"First","propertyType":"flow","rules":[{"t":"eq","v":"none","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":450,"y":220,"wires":[["53884dfc.d73504","a60279a1.ef4aa8"]]},{"id":"53884dfc.d73504","type":"delay","z":"d08e5ad8.f69718","name":"","pauseType":"delay","timeout":"10","timeoutUnits":"milliseconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":730,"y":160,"wires":[["bf9251ae.dff4c"]]},{"id":"78a77ab8.4013a4","type":"debug","z":"d08e5ad8.f69718","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":1140,"y":340,"wires":[]}]

PS you also need to initially set the flow context to "none" or else it won't work

1 Like

Yeah I'm getting this too, even with a response added. She is just giving me the error but still doing what I asked. :expressionless:

I played with the Alexa Blueprint last night and was able to eliminate about 15 routines. It also motivated me to implement voice commands to turn on different channels on my Roku w/ my voice since I no longer have to add a new dummy routine for each variation. So far, that works also. I went back and edited my original post describing this example and recommend Alexa Blueprints in case someone is reading from beginning.

1 Like

I think I may need to do some renaming of lights and lamps, and avoid the errors. This is very nice though :slight_smile:

I updated my button tap subflow, now it traps doubletap and held events - you can define how many "taps" a held event is.. Previously I was using this for a pico in quick mode but now can be used for buttons like smartthings button or others maybe. Also taps exceeding the 4 by default will get sent through the 4th output - you would need to check the "msg.count" property.

Updated code now on this post:

Here was the original post:

3 Likes

Looking for advice from anyone using lux readings to automate lights. I'm trying to decide what approach would be reasonable or most effective using the "Calculate" node (or any other node that does average, max, min over a period of time). Do you use average readings or max or min? Over what period (minute or more)?

Currently, my automations work well unless there is moving cloud cover causing the lights to cycle on/off. Appreciate any guidance you can provide.

No right answer on this one - it depends on personal tastes, and how fast your lux sensor updates.

I like the smooth node (node-red-node-smooth) for smoothing signals, but there are a number of other nodes that can do it.

Here are some examples of response on my outdoor lux reading that updates 1x/minute (weatherflow weather station).

The trick is how fast you want the automation to react. I don't like the lights shifting frequently/fast, so I use a fairly high filter. Mean 3 or Mean 5 works well for that, with values at the 1x/min frequency. If you want it faster, or your lux readings come in faster/slower you would have to adjust that.

As you would guess, the dips are clouds that went by.

Raw vs Low pass filters:

Raw vs Means:

1 Like

Yeah - This one is an Aeotec MS6 using @csteele’s driver. I have it set to report on a 2 Lux change (works for me since it’s indoors). Since I’m logging all changes, I think I can go back and look how quickly it’s reporting but I’m going to have to find a day that matches cloudy conditions!

I think I may start with a “max” value and 1 minute and see how that goes. Thoughts?

You won't like my thought on using the MS6 for lux control. :slight_smile:

In my OPINION, for GOOD lux control you need something that reports more frequently. For indoor lux I would want something that reports in the order of 5-15s continually so that predictable filtering can be done. Easy to do with a Arduino/esp8266 on mains power, not so easy to do on a battery powered device, or a z sensor on mains power (as they still typically only repeat on change, plus a slow fixed time interval).

That said, go back and look at how it reports on a cloud event. For a sensor that reports infrequently, using a time relay with reset instead of averaging or a filter may be more appropriate.

1 Like

I use these

4 Likes

For my simplistic use as a basic lux detector in NR I created subflow with a set of ranges defined as none/low/medlow/med/medhi/hi and simply key off the lux value. This works well as long as I leave a sufficient enough gap between the ranges. A usb powered MS-6 works great for this..

If I were to get more sophisticated like setting dimming levels or other stuff based on lux however then heck yes - more accurate sensor + much better algorithm like the smoothing node (thanks for the heads up on that btw).

1 Like

Yeah - my MS6 is USB powered, so does report fairly frequently. However, it doesn't look like I have multiple readings in less than a minute.

Could you share the ranges that you have defined? I'm currently using <=20 as "on", >=30 as "off". This works "most" of the time.