Getting started with node red

Forgive me, as this is going to be a complete newbie question; but I'm looking for a good place to get started with moving some of my rules off of RM onto node red. I'm unfortunately one of those users that really wants one hub to do it all, but as I'm finding out over the last several weeks as I start to really get involved with my rules I'm having a few more "wonder why that didn't happen" moments (i.e. HSM doesn't disarm when presence is detected, even though I can see in the logs the rule fires and most of the time it works; its those other times something gets missed that bothers my OCD).

I've got node red running and it can pull information from HE; is there a good place to go that can get me started getting rules into node red flows to run automatically? Even something as simple as how to get a light to turn on and off at a certain time would get me started. Bear in mind I have zero programming experience (pharmacist...I can sell you drugs legally...but I never got into programming as anything more than a side hobby), most of what I know comes from browsing the forums and Google. That and this post from @csteele have really gotten me to peering in the rabbit hole.

Any pointers are greatly appreciated; and to be clear I have zero issues with HE itself. As a former ST user I am extremely pleased with HE, so if NR turns out to be more involved than the pharmacy world allows, I'm still happy with the performance of HE as is even with the occasional quirks, but from what I read NR opens up a lot of possibilities.

1 Like

Offloading Rules to another "Hub" (and in this situation, a Node-Red instance is a hub in my mind) does only that, it moves that processing from this to that. If that opens enough resources on your Hubitat Hub, great.

There's no guarantee though. :frowning:

Node-Red does the same thing Hubitat does in my opinion.. opens the potential for doing MORE MORE more. :smiley:

If we were all doing ONLY what worked on ST, none of us would be looking at alternative processing architectures. :smiley:

Here's a pair of Flows that might get you started.. one has a time restriction, one doesn't.

Motion kicks each off (trigger) and turns on the light. When motion goes inactive, a timer starts... any new motion stops the timer. If the timer does get to it's limit, it turns the light off.

I think this is one of the most basic Node-Red flows in the Hubitat world. :smiley:

Here's what the Active/Inactive switch node is doing: Screen Shot 2020-07-16 at 9.23.52 AM

Cancelable node is a Change Node and it's doing: Screen Shot 2020-07-16 at 9.25.09 AM

And for completeness, here's the stoptimer: Screen Shot 2020-07-16 at 9.26.00 AM

I add an Inject node to most of my Flows... most of the time it's not needed BUT over time I've found myself adding, deleting, adding back, deleting again.. adding back a third time, etc. and Now I just leave them.


I am by no means an expert but youtube videos were very useful for me

turning lights on a certain time can be accomplished using a cron plus node from node-red-contrib-cronplus and a node from node-red-contrib-hubitat both of those need to be added to you palette ( learning and finding tools to add to the palette is interesting

my alarm flow
if its 7 am and a weekday and I am home set mode to worktime


Here's a simple sequence that turns a light on at sunset -60 and turns it off at sunrise

Screen Shot 2020-07-16 at 11.28.54 AM

Sequence ....

[{"id":"e64512e7.cb54e","type":"switch","z":"4b4077ac.455df8","name":"on or off","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"on","vt":"str"},{"t":"eq","v":"off","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":440,"y":740,"wires":[["456981a4.241da"],["f4011401.17466"]]},{"id":"c31c32b6.82afb8","type":"bigtimer","z":"4b4077ac.455df8","outtopic":"","outpayload1":"","outpayload2":"","name":"Sunset (-60) to Sunrise","comment":"","lat":"29.977091","lon":"-90.143000","starttime":"5004","endtime":"5003","starttime2":0,"endtime2":0,"startoff":"-60","endoff":"0","startoff2":0,"endoff2":0,"offs":0,"outtext1":"","outtext2":"","timeout":1440,"sun":true,"mon":true,"tue":true,"wed":true,"thu":true,"fri":true,"sat":true,"jan":true,"feb":true,"mar":true,"apr":true,"may":true,"jun":true,"jul":true,"aug":true,"sep":true,"oct":true,"nov":true,"dec":true,"day1":0,"month1":0,"day2":0,"month2":0,"day3":0,"month3":0,"day4":0,"month4":0,"day5":0,"month5":0,"day6":0,"month6":0,"day7":"","month7":"","day8":"","month8":"","day9":"","month9":"","day10":"","month10":"","day11":"","month11":"","day12":"","month12":"","d1":0,"w1":0,"d2":0,"w2":0,"d3":0,"w3":0,"d4":0,"w4":0,"d5":0,"w5":0,"d6":0,"w6":0,"xday1":0,"xmonth1":0,"xday2":0,"xmonth2":0,"xday3":0,"xmonth3":0,"xday4":0,"xmonth4":0,"xday5":0,"xmonth5":0,"xday6":0,"xmonth6":0,"xd1":0,"xw1":0,"xd2":0,"xw2":0,"xd3":0,"xw3":0,"xd4":0,"xw4":0,"xd5":0,"xw5":0,"xd6":0,"xw6":0,"suspend":false,"random":false,"repeat":false,"atstart":false,"odd":false,"even":false,"x":230,"y":740,"wires":[[],["e64512e7.cb54e"],[]]},{"id":"456981a4.241da","type":"hubitat command","z":"4b4077ac.455df8","name":"Front Porch on","server":"662851c4.3ccad","deviceId":"4201","command":"on","commandArgs":"","x":640,"y":720,"wires":[[]]},{"id":"f4011401.17466","type":"hubitat command","z":"4b4077ac.455df8","name":"Front Porch off","server":"662851c4.3ccad","deviceId":"4201","command":"off","commandArgs":"","x":640,"y":760,"wires":[[]]},{"id":"662851c4.3ccad","type":"hubitat config","z":"","name":"HubitatS","usetls":false,"host":"","port":"80","appId":"4489","nodeRedServer":"","webhookPath":"/hubitat/webhook2","autoRefresh":true,"useWebsocket":false}]

this thread is a good place to start building your Palette


And this right here is why I love this community! Thanks guys, those have given me a few more places to get started!

yep, I spent a few hours the other day just browsing available nodes for the palette; a little overwhelming, but also enlightening to the amount of possibilities

From a glance, looks like the bigtimer node to kick it off?


In @aaiyar post, he's got a Sequence 'twistie' under the image. Click it and the whole Flow code is shown. Copy those characters.. then in Node-Red, using the 'hamburger' menu in the upper right, select Import. Then paste the code into that form and click the NEW FLOW button.

That will copy the entire flow into YOUR Node-Red, BUT it will include Ashok's Hubitat hub Selections.. If you're just trying to grab ideas, you don't need to worry.. when you're done reviewing, just double click the flow tab and delete the entire flow.


If your not seeing what it is that @csteele is referring too

Click that arrow next to the word "Sequence" and then highlight everything @aaiyar posted under it. Take that and "import"/paste it into NR. This will allow you to use other peoples flows in your system! It is one of the greatest things about NR, IMO. We can share flows/rules and do not need to make them from scratch.

If you import a flow that uses nodes you do not have installed NR will prompt you to install them. It is very cool. Being new as well, I have never shared one, so here goes....

This flow turns a light on 25%, but only between certain hours. It includes a timer shut off with a cancellation if more motion is detected. Enjoy!!

Flow / Sequence ....

[{"id":"222ab041.8e8c1","type":"within-time-switch","z":"2b8ea305.21e4dc","name":"8pm-7am","nameInt":"","positionConfig":"7d0e8fed.fdaa5","startTime":"20:00","startTimeType":"entered","startOffset":0,"startOffsetType":"none","startOffsetMultiplier":60000,"endTime":"07:00","endTimeType":"entered","endOffset":0,"endOffsetType":"none","endOffsetMultiplier":60000,"timeDays":"","timeOnlyOddDays":false,"timeOnlyEvenDays":false,"timeMonths":"","timedatestart":"","timedateend":"","propertyStart":"","propertyStartType":"none","propertyStartCompare":"true","propertyStartThreshold":"","propertyStartThresholdType":"num","startTimeAlt":"","startTimeAltType":"entered","startOffsetAlt":0,"startOffsetAltType":"none","startOffsetAltMultiplier":60000,"propertyEnd":"","propertyEndType":"none","propertyEndCompare":"true","propertyEndThreshold":"","propertyEndThresholdType":"num","endTimeAlt":"","endTimeAltType":"entered","endOffsetAlt":0,"endOffsetAltType":"none","endOffsetAltMultiplier":60000,"tsCompare":"0","x":560,"y":2060,"wires":[["abcaa912.89c168"],[]]},{"id":"7c799c3e.bdbfd4","type":"hubitat device","z":"2b8ea305.21e4dc","name":"Kitchen Beam Motion","server":"e40ec0b5.83be","deviceId":"2376","attribute":"motion","sendEvent":true,"x":160,"y":2080,"wires":[["9edd7657.da71f8"]]},{"id":"3293ddcd.b5fd52","type":"hubitat command","z":"2b8ea305.21e4dc","name":"Under cabinet lights On","server":"e40ec0b5.83be","deviceId":"590","command":"on","commandArgs":"","x":930,"y":2060,"wires":[["3c2d811a.2d4fce"]]},{"id":"9edd7657.da71f8","type":"switch","z":"2b8ea305.21e4dc","name":"Active/Inactive","property":"payload.value","propertyType":"msg","rules":[{"t":"eq","v":"active","vt":"str"},{"t":"eq","v":"inactive","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":380,"y":2100,"wires":[["222ab041.8e8c1"],["c1ed629e.b8e3c"]]},{"id":"4a3b8913.620c88","type":"hubitat command","z":"2b8ea305.21e4dc","name":"Under cabinet lights Off","server":"e40ec0b5.83be","deviceId":"590","command":"off","commandArgs":"","x":1610,"y":2120,"wires":[[]]},{"id":"abcaa912.89c168","type":"hubitat command","z":"2b8ea305.21e4dc","name":"Set to 25%","server":"e40ec0b5.83be","deviceId":"590","command":"setLevel","commandArgs":"25","x":730,"y":2060,"wires":[["3293ddcd.b5fd52"]]},{"id":"1c972d21.76a9f3","type":"comment","z":"2b8ea305.21e4dc","name":"Under Cabinet Night Lighting","info":" - ","x":120,"y":2020,"wires":[]},{"id":"aa9b2768.d82258","type":"stoptimer","z":"2b8ea305.21e4dc","duration":"1","units":"Minute","payloadtype":"num","payloadval":"0","name":"","x":1400,"y":2120,"wires":[["4a3b8913.620c88"],[]]},{"id":"3c2d811a.2d4fce","type":"change","z":"2b8ea305.21e4dc","name":"Send STOP","rules":[{"t":"set","p":"payload","pt":"msg","to":"STOP","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1130,"y":2060,"wires":[["aa9b2768.d82258"]]},{"id":"11d3c06c.3197f","type":"hubitat device","z":"2b8ea305.21e4dc","name":"Kitchen Wide Motion","server":"e40ec0b5.83be","deviceId":"2759","attribute":"motion","sendEvent":true,"x":160,"y":2140,"wires":[["9edd7657.da71f8"]]},{"id":"d6cd7157.3ecb9","type":"switch","z":"2b8ea305.21e4dc","name":"Active/Inactive","property":"payload.value","propertyType":"msg","rules":[{"t":"eq","v":"active","vt":"str"},{"t":"eq","v":"inactive","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":1200,"y":2120,"wires":[[],["aa9b2768.d82258"]]},{"id":"e43a4f26.c96bc","type":"hubitat device","z":"2b8ea305.21e4dc","name":"Kitchen Wide Motion","server":"e40ec0b5.83be","deviceId":"2759","attribute":"motion","sendEvent":false,"x":1000,"y":2120,"wires":[["d6cd7157.3ecb9"]]},{"id":"c1ed629e.b8e3c","type":"hubitat device","z":"2b8ea305.21e4dc","name":"Kitchen Beam Motion","server":"e40ec0b5.83be","deviceId":"2376","attribute":"motion","sendEvent":false,"x":600,"y":2120,"wires":[["4f52244f.6b7bcc"]]},{"id":"4f52244f.6b7bcc","type":"switch","z":"2b8ea305.21e4dc","name":"Active/Inactive","property":"payload.value","propertyType":"msg","rules":[{"t":"eq","v":"active","vt":"str"},{"t":"eq","v":"inactive","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":800,"y":2120,"wires":[[],["e43a4f26.c96bc"]]},{"id":"7d0e8fed.fdaa5","type":"position-config","z":"","name":"localPosition","isValide":"true","longitude":"0","latitude":"0","angleType":"deg","timeZoneOffset":99,"timeZoneDST":0,"stateTimeFormat":"3","stateDateFormat":"12"},{"id":"e40ec0b5.83be","type":"hubitat config","z":"","name":"Devices Hub","usetls":false,"host":"","port":"80","appId":"2532","nodeRedServer":"","webhookPath":"/hubitat/webhook","autoRefresh":true,"useWebsocket":false}]


Yup. I think @csteele includes that node in his RPi build.

1 Like

17 posts were merged into an existing topic: Hubitat slowing down after a few days

I found the following useful:

Node-Red YouTube Channel

Hubitat Config Node

Node-RED + Home Assistant How-To - Although very HA orientated

1 Like

Keeping this back on topic, I found myself trawling through posts to find flows to give me inspiration or help on building nodes. I've started to collate them and may help others

Motion Flow


Motion Flow with Delay off (using node-red-contrib-stoptimer-varidelay)

Motion flow with Modes - Slightly different approach than the above 2 and different action depending on mode


Motion approach by @JasonJoel

Motion Lighting with time of day parameters by @csteele
Screen Shot 2020-07-16 at 9.23.52 AM
Screen Shot 2020-07-16 at 9.25.09 AM
Screen Shot 2020-07-16 at 9.26.00 AM

Setting mode with presence by @pat.richards

Turning on Porch Light by @aaiyar
Screen Shot 2020-07-16 at 11.28.54 AM

Under Cabinet lighting by @TechMedX

Basic Button Sequence by @waynespringer79


Light Control via music and Alexa by @stephen_nutt
The "On Device Activity" Device Node listens and if it hears Alexa, it turns Dining Room light on then turns it off 10 seconds later. If it hears Alexa Stop, it turns Dining Room light off.
The "On Audio Player State Change" Device Node listens and if "Playing" is in output payload, it turns Dining Room light on and cancels the mytimeout node which keeps the Dining Room light from turning off.

Know Idea what this does by @mike

TTS based on power by @JasonJoel
Screenshot 2020-03-31 at 11.05.40 AM

Garage Door Open/Closed and TTS by @aaiyar

Garage timeout based on active sensor by @stephen_nutt

Motion flows by @Royski (warning uses deCONZ)


Impressive work thank you for this... I wonder if we could set up a repository for flows maybe on github....


That would be cool, as I sometimes struggle to know what data is inside the nodes and would definitely help to have a searchable record as it would be incredibly simple for people to copy and alter instead of trying to re-create the wheel each time


+1 on each of these; I think the part I have been scratching my head over the most is what data is in each node and how each is set up to pass it on. Seeing more of the community flows and how members have them set up has made it a lot easier for me to wrap my head around how to set up flows a little better (without having to re-invent the wheel). Since it does seem to come up often, and using myself as an example, I definitely agree it would be most beneficial if there were a decent guide/repository for beginners to learn to take the dive into NR.

Each very helpful I found to get started, but just not enough for that final push to get everything to work.

Of course YOU could - no one is stopping anyone from doing that.

Funny how when people say "we" they really mean "not me" most of the time. :wink:

(OK - that was just a bit of teasing. It isn't a bad idea, but either someone would have to take the lead in making it and the long term maintenance of it, or it probably wouldn't get used.

Most end users aren't likely to load flows into it long term, and if they did without an administrator curating them for content and structure it would be a jumbled mess in a month.

So if this were to happen, someone needs to administrate/maintain the repository, which is not a trivial amount of work initially - and if the are ever major changes to the nodes or Maker API it would be a lot of work at that time as well.

I am well aware of how much work this idea is, which is why I won't be the one to do it.)



I am more than willing to help and take on some of the work but I have only been using my HE for less than 6 months at this time and I believe we need some experience to make this work.

So yes I volunteer to help but not to lead

Fun thing to find out this morning; apparently NR runs everything in UTC time? Which would explain why I have been banging my head trying to figure out why flows were not triggering when I thought they should. Maybe I missed that small detail in the documentation somewhere :roll_eyes:

Once that was figured out...easy enough to finally get something simple working. I did find I like the light scheduler (noe-red-contrib-light-scheduler by niklaswall) for the graphical representation of on/off periods. Thanks to @Shaneb for the collation of various flows; I'm definitely finding NR on the visual aspect to be easier to wrap my head around than RM.

Most (although not all) Node-RED nodes will use local time. However, you have to have the timezone set correctly on the node-red host if you want to do logic based on local time.

How that timezone definition is done depends on where you are running it - Rpi, docker, k8s, etc. E.g. for docker you have to set an environmental variable "TZ" to the correct timezone.


I have a question about using HE and a Node Red Dashboard. I created switches, and got them to work great. Issue I have is with if a automation I have or a switch is manually turned on, it is not updated in the Node red dashboard. I see an example here for HomeSeer and keeping the dashboard in sync, but cant see one for Hubitat, and trying to move away from the built in HE dashboard to get a new NR one made (See: Keeping a Node-Red Dashboard in sync with HomeSeer - HomeSeer Message Board). I have searched, but see no examples from users, but I know some of you must have a dashboard, and if anyone is willing to share how they keep a light switch, etc in sync on the dashboard, I would REALLY appreciate a sample flow.