Node-Red Flow Samples/Sharing

This is a great thread.

I am very new to node red and was hoping to get some help with what should be a relatively easy flow.

I have a presence sensor that, when detected and made present by hubitat through the system I have setup, should open my garage and unlock my door in that garage. And if I leave, it should close the garage and lock the door in the garage too. It isnt working as expected (at all) though and I am pretty sure it is user error due to my being so new at this.

Also I am not sure how to get pushover to send me a message in node red either. I do have it set up with hubitat and the API keys are in place as well

Any ideas on what I need to do to correct this? Thanks for any help.

Couple of things..

  • You are using HE command nodes for the presence sensor. I think you want the HE Device nodes.. and make sure "send events" is checked.
  • the time range node, where is that from, it's not stock - what does the properties page look like? Yellow would indicate something is out of range somehow but maybe that was the last time an event happened. You might check your system time as well to make sure it's set to your local time.
  • make sure your palette is up to date

Here's a very simple example:

1 Like

Thank you @erktrek I will check this right now:

1 Like

It's fine - I don't think that is your issue but could you screen shot the properties page of that node?

Here is mine:

The time range was something I installed because I dont see a stock time range to use. Where would it be or what is it called?

Here is the properties page for the time range node as requested, but I would rather just use the stock one for now if I could find it lol.

1 Like

I use a sequence very similar to that posted by @erktrek, with the garage door being controlled by the status of a presence sensor in my car. I do use the time range node to that the door can be raised only between certain hours.

Also, I check the door status before either raising it (upon arrival) or lowering it (upon departure).

2 Likes

I goofed on the switch node - it should be "present/not present" for the msg.payload.value comparison!!!!

i dont know where this time range default node is.

would you be willing to share that flow? im having a hard time of it. I am used to SmartThings/WebCoRE but think NodeRED by be better for hubitat. WebCoRE is seeing the changes for present/not present on the firsty try for some reason.

Mine is part of the "node-red-contrib-sun-position" nodes.. handy for sun position calcs etc..

1 Like

There isn't one. You are using the one that I use. Just make sure you enter your latitude and longitude to configure that node.

1 Like

oh ok. The property page for yours look different. Thanks for clearing that up. :slight_smile:

2 Likes

No problem. Here you go:

Sequence

[{"id":"9e8492cf.83872","type":"hubitat device","z":"afda3b03.8d448","name":"Ashok's Car Presence","server":"a22e0ea9.276dc8","deviceId":"1831","attribute":"presence","sendEvent":true,"x":190,"y":1820,"wires":[["c192cfee.34db68"]]},{"id":"c192cfee.34db68","type":"switch","z":"afda3b03.8d448","name":"present/not present","property":"payload.value","propertyType":"msg","rules":[{"t":"eq","v":"present","vt":"str"},{"t":"eq","v":"not present","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":440,"y":1820,"wires":[["a97d8eb.363fa7"],["a7e28a4e.54c43"]]},{"id":"a97d8eb.363fa7","type":"delay","z":"afda3b03.8d448","name":"","pauseType":"delay","timeout":"2","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":595,"y":1780,"wires":[["ebd0a748.7b5068"]],"l":false},{"id":"a7e28a4e.54c43","type":"hubitat device","z":"afda3b03.8d448","name":"Contact - Garage Door","server":"662851c4.3ccad","deviceId":"4557","attribute":"contact","sendEvent":false,"x":690,"y":1860,"wires":[["15eed554.2d2c7b"]]},{"id":"ebd0a748.7b5068","type":"switch","z":"afda3b03.8d448","name":"just_arrived = t","property":"just_arrived","propertyType":"global","rules":[{"t":"true"}],"checkall":"true","repair":false,"outputs":1,"x":720,"y":1780,"wires":[["f96f480.efb8cb8"]]},{"id":"15eed554.2d2c7b","type":"switch","z":"afda3b03.8d448","name":"open","property":"payload.value","propertyType":"msg","rules":[{"t":"eq","v":"open","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":890,"y":1860,"wires":[["50a021d6.db4df8"]]},{"id":"f96f480.efb8cb8","type":"time-range-switch","z":"afda3b03.8d448","name":"Dawn-9PM","lat":"29.977091","lon":"-90.143000","startTime":"sunrise","endTime":"21:00","startOffset":0,"endOffset":0,"x":910,"y":1780,"wires":[["fd722222.093e4"],[]]},{"id":"50a021d6.db4df8","type":"hubitat command","z":"afda3b03.8d448","name":"Garage Door Down ON","server":"662851c4.3ccad","deviceId":"226","command":"on","commandArgs":"","x":1090,"y":1860,"wires":[[]]},{"id":"fd722222.093e4","type":"hubitat device","z":"afda3b03.8d448","name":"Contact - Garage Door","server":"662851c4.3ccad","deviceId":"4557","attribute":"contact","sendEvent":false,"x":1190,"y":1780,"wires":[["5cba2204.3ec434"]]},{"id":"5cba2204.3ec434","type":"switch","z":"afda3b03.8d448","name":"closed","property":"payload.value","propertyType":"msg","rules":[{"t":"eq","v":"closed","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":1400,"y":1780,"wires":[["ecea6f9f.fb7548"]]},{"id":"ecea6f9f.fb7548","type":"hubitat command","z":"afda3b03.8d448","name":"Garage Door Up ON","server":"662851c4.3ccad","deviceId":"225","command":"on","commandArgs":"","x":1600,"y":1780,"wires":[[]]},{"id":"a22e0ea9.276dc8","type":"hubitat config","name":"HubitatM","usetls":false,"host":"192.168.1.46","port":"80","appId":"1522","nodeRedServer":"http://192.168.1.4:1880","webhookPath":"/hubitat/webhook","autoRefresh":true,"useWebsocket":false,"colorEnabled":true,"color":"#5dd049"},{"id":"662851c4.3ccad","type":"hubitat config","name":"HubitatS","usetls":false,"host":"192.168.1.36","port":"80","appId":"4489","nodeRedServer":"http://192.168.1.4:1880","webhookPath":"/hubitat/webhook2","autoRefresh":true,"useWebsocket":false,"colorEnabled":true,"color":"#51b8f0"}]

You also need to use the HE Device node NOT the command node for your HE presence device.

1 Like

you two are great! thank you for the help. Its a lot to get used to

1 Like

that was changed per your suggestion earlier. thank you for that

2 Likes

Happy to help!!! Been there and done that - I used WebCoRE a lot too.. love the interface was very logical. However I find Node-RED much better at scaling and the visual flow aspect is very logical/intuitive too but certainly different paradigm..

2 Likes

image

@aaiyar Why is this delay here? I usually put a delay on away (btween 30-60 seconds typically) in case the presence drops for whatever reason to keep a false away and subsequence false arrival from happening. Not sure if this is something specific to your system at your house?

Good question.

Here's the explanation. I want my car's presence sensor to raise the garage door only if my car's presence is detected within 5 minutes of my phone entering a specified geofence around my house.

Because there's a possibility that my car's presence sensor will be detected before my phone is detected as entering the geofence, I put a 2 second delay there. That is long enough for my phone to be detected and it sets the global variable just_arrived to be true.

I understand. I am working to be rid of geofences so I am going to try using it without that delay as my setup does not use geofencing at all currently. It also doesnt work right yet either :stuck_out_tongue:

1 Like