Node-Red Flow Samples/Sharing

Title - Randomized greeting/departure announcement

Summary - This one will take a little bit of work to convert to the HE node pallet, but somebody adventurous can give it a go (I'm looking at you @aaiyar since you've got the wait conditions with loops figured out :stuck_out_tongue: ). I have lots of fun with this one.

This is triggered by presence arrival/departure for 2 people. Checks who arrived (or both) within the past 5 minutes, chooses a randomized arrival greeting, waits for door to open and then close and speaks the random greeting on Alexa. Could easily be expanded to support more people by expanding the names in the unsafe-function node.
Picture -

Flow

[{"id":"fe22ec90.1f7b4","type":"ha-get-entities","z":"43efc72.aa76338","server":"94fdcfdf.a00b","name":"","rules":[{"property":"entity_id","logic":"includes","value":"switch.mike_presence, switch.ashley_presence","valueType":"str"},{"property":"state","logic":"is","value":"on","valueType":"str"},{"property":"timeSinceChangedMs","logic":"lt","value":"300000","valueType":"num"}],"output_type":"split","output_empty_results":false,"output_location_type":"msg","output_location":"payload","output_results_count":1,"x":130,"y":460,"wires":[["dce1b1d1.9a685"]]},{"id":"dce1b1d1.9a685","type":"template","z":"43efc72.aa76338","name":"Format Names","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"{{payload.attributes.friendly_name}}","output":"str","x":300,"y":460,"wires":[["c675d5c9.a6bdd8"]]},{"id":"c675d5c9.a6bdd8","type":"join","z":"43efc72.aa76338","name":"","mode":"custom","build":"string","property":"payload","propertyType":"msg","key":"topic","joiner":", ","joinerType":"str","accumulate":false,"timeout":"","count":"","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":450,"y":460,"wires":[["eef7b7e8.d8c558"]]},{"id":"eef7b7e8.d8c558","type":"unsafe-function","z":"43efc72.aa76338","name":"Random Message","func":"var device=msg.payload\nmsg.payload = {};\nmsg.payload.domain = {};\nmsg.payload.service = {};\nmsg.payload.data = {};\nmsg.payload.data.data = {};\nmsg.payload.data.data.type = {};\nmsg.payload.data.message = {};\n\nif (device == 'Mike - Presence') {\n var name = 'Mike';\n var isAre = 'is';\n} else if (device === 'OTHER - Presence') {\n var name = 'OTHER';\n var isAre = 'is';\n} else if (device == 'Mike - Presence, OTHER - Presence' || device == 'OTHER - Presence, Mike - Presence') {\n var name ='Mike and OTHER';\n var isAre = 'are';\n}\n\nvar messageOpening = [\n "Welcome Home",\n "How you doing",\n "What's up",\n "Long time no see",\n "Hey",\n "Nice to see you",\n "Look who's home, it's",\n "Nice to have you back",\n "Howdy do",\n "What's going on",\n "How is everything",\n "It's feels like ages since I've seen you",\n "Where have you been hiding",\n "How's it hanging",\n "What's cookin",\n "What's shakin",\n "Greetings and salutations",\n "How goes it",\n "What's happening",\n "How goes it",\n "Roll out the red carpet for"\n];\n\nvar messageClosing = [\n "in the house! Ooo oooo",\n "here.",\n "home.",\n "joining the party",\n "crashing the party",\n "gracing us with their presence",\n "dropping anchor",\n "dropping in",\n "making the scene",\n "barging in",\n "showing up",\n "blowing in",\n "appearing",\n "breezing in",\n "rolling in",\n "popping in",\n "finally home"\n];\n\n\nvar randomOpening = messageOpening[Math.floor(Math.random()*messageOpening.length)];\nvar randomClosing = messageClosing[Math.floor(Math.random()*messageClosing.length)];\nvar message = randomOpening + " " + name + "." + " " + name + " " + isAre + " " + randomClosing\n\nmsg.payload.domain = "notify"\nmsg.payload.service = "alexa_media_front_entrance_echo_dot"\nmsg.payload.data.data.type = "announce"\nmsg.payload.data.message = message\n\nreturn msg;","outputs":1,"noerr":0,"x":610,"y":460,"wires":[["b4e71139.15e7b"]]},{"id":"b4e71139.15e7b","type":"ha-wait-until","z":"43efc72.aa76338","name":"Door Opens","server":"94fdcfdf.a00b","outputs":2,"entityId":"binary_sensor.garage_door","entityIdFilterType":"exact","property":"state","comparator":"is","value":"on","valueType":"str","timeout":"5","timeoutType":"num","timeoutUnits":"minutes","entityLocation":"","entityLocationType":"none","checkCurrentState":true,"blockInputOverrides":true,"x":790,"y":460,"wires":[["e9446d66.c088b"],[]]},{"id":"e9446d66.c088b","type":"ha-wait-until","z":"43efc72.aa76338","name":"Door Closes","server":"94fdcfdf.a00b","outputs":2,"entityId":"binary_sensor.garage_door","entityIdFilterType":"exact","property":"state","comparator":"is","value":"off","valueType":"str","timeout":"5","timeoutType":"num","timeoutUnits":"minutes","entityLocation":"","entityLocationType":"none","checkCurrentState":true,"blockInputOverrides":true,"x":950,"y":460,"wires":[["9a733390.064f4"],[]]},{"id":"9a733390.064f4","type":"api-call-service","z":"43efc72.aa76338","name":"Speak Message","server":"94fdcfdf.a00b","version":1,"debugenabled":false,"service_domain":"notify","service":"alexa_media_front_entrance_echo_dot","entityId":"","data":"","dataType":"json","mergecontext":"","output_location":"payload","output_location_type":"msg","mustacheAltTags":false,"x":1120,"y":460,"wires":[[]]},{"id":"b1e2d385.f986d","type":"ha-get-entities","z":"43efc72.aa76338","server":"94fdcfdf.a00b","name":"","rules":[{"property":"entity_id","logic":"includes","value":"switch.mike_presence, switch.ashley_presence","valueType":"str"},{"property":"state","logic":"is","value":"off","valueType":"str"},{"property":"timeSinceChangedMs","logic":"lt","value":"300000","valueType":"num"}],"output_type":"split","output_empty_results":false,"output_location_type":"msg","output_location":"payload","output_results_count":1,"x":130,"y":560,"wires":[["c069c1d8.2ffeb"]]},{"id":"c069c1d8.2ffeb","type":"template","z":"43efc72.aa76338","name":"Format Names","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"{{payload.attributes.friendly_name}}","output":"str","x":300,"y":560,"wires":[["b1e03b81.244208"]]},{"id":"b1e03b81.244208","type":"join","z":"43efc72.aa76338","name":"","mode":"custom","build":"string","property":"payload","propertyType":"msg","key":"topic","joiner":", ","joinerType":"str","accumulate":false,"timeout":"","count":"","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":450,"y":560,"wires":[["ee858f3e.2a157"]]},{"id":"ee858f3e.2a157","type":"unsafe-function","z":"43efc72.aa76338","name":"Random Message","func":"var device=msg.payload\nmsg.payload = {};\nmsg.payload.domain = {};\nmsg.payload.service = {};\nmsg.payload.data = {};\nmsg.payload.data.data = {};\nmsg.payload.data.data.type = {};\nmsg.payload.data.message = {};\n\nif (device == 'Mike - Presence') {\n var name = 'Mike';\n var hasHave = 'has';\n} else if (device === 'OTHER - Presence') {\n var name = 'OTHER';\n var hasHave = 'has';\n} else if (device == 'Mike - Presence, OTHER - Presence' || device == 'OTHER - Presence, Mike - Presence') {\n var name ='Mike and OTHER';\n var hasHave = 'have';\n}\n\nvar messageOpening = [\n "Goodbye",\n "See you later",\n "Bye",\n "Live long and prosper",\n "Farewell",\n "Hope you have a great time",\n "Take care",\n "Smell you later",\n "Adios",\n "Caio",\n "Au revoir",\n "Sayonara",\n "Ta Ta for now",\n "Catch you later",\n "To-da-loo",\n "See you in the funny papers",\n "Toodles",\n "Godspeed",\n "So long",\n "Cheerio",\n "Arrivederci"\n];\n\nvar messageClosing = [\n "left the building",\n "gone out",\n "popped out",\n "left",\n "buggered off",\n "departed",\n "split",\n "vamoosed",\n "high tailed it",\n "escaped",\n "eight-six'd it",\n "bid farewell",\n "flaked off",\n "took a hike",\n "withdrawn",\n "exited",\n "vanished",\n "disappeared",\n "evacuated",\n "retreated",\n "taken their leave"\n];\n\n\nvar randomOpening = messageOpening[Math.floor(Math.random()*messageOpening.length)];\nvar randomClosing = messageClosing[Math.floor(Math.random()*messageClosing.length)];\nvar message = randomOpening + " " + name + "." + " " + name + " " + hasHave + " " + randomClosing\n\nmsg.payload.domain = "notify"\nmsg.payload.service = "alexa_media_front_entrance_echo_dot"\nmsg.payload.data.data.type = "announce"\nmsg.payload.data.message = message\n\nreturn msg;","outputs":1,"noerr":0,"x":610,"y":560,"wires":[["904ffb9e.c47158"]]},{"id":"904ffb9e.c47158","type":"delay","z":"43efc72.aa76338","name":"","pauseType":"delay","timeout":"1","timeoutUnits":"minutes","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":780,"y":560,"wires":[["8cf021e4.e7e3e"]]},{"id":"8cf021e4.e7e3e","type":"api-call-service","z":"43efc72.aa76338","name":"Speak Message","server":"94fdcfdf.a00b","version":1,"debugenabled":false,"service_domain":"notify","service":"alexa_media_front_entrance_echo_dot","entityId":"","data":"","dataType":"json","mergecontext":"","output_location":"payload","output_location_type":"msg","mustacheAltTags":false,"x":940,"y":560,"wires":[[]]},{"id":"893c5b2b.7de1f8","type":"comment","z":"43efc72.aa76338","name":"Announce departue","info":"","x":150,"y":520,"wires":[]},{"id":"46989487.63407c","type":"comment","z":"43efc72.aa76338","name":"Announce arrival","info":"","x":140,"y":420,"wires":[]},{"id":"94fdcfdf.a00b","type":"server","z":"","name":"Home Assistant","addon":true}]

2 Likes

I tried to import your flow because, for one, it's cool. But I keep getting this error
image
When I look at it, the code looks consistent to me, but I know about enough to be dangerous. Why the error? How do you fix it? Like, what's wrong? I'm sorry to be so curious. Helps me learn.

1 Like

interesting we had the same kind of issue with @aaiyar network monitoring code

1 Like

Yeah - it has a link out. When I’m back from my walk, I’ll fix it .... my bad

Just shared a flow with someone else and got a syntax error and he actually tried to copy and paste the flow back in to his node red and got the same error on something that's already created in HIS node red. Could this be a bug?

I suspect that something is being changed by posting it

maybe try using
code tags

test
more test

the error I am getting
at position 2060
font color="cyan">{{msg.

C in Cyan being highlighted

@pat.richards @TechMedX

Would you mind importing it again? It should work now. I removed the link out/in nodes and tested importing it. The modified flow is in my original response (further up this thread).

Sorry about the hassle.

1 Like

same error same place

1 Like

It imports fine for me and is in a code block. So was the original ... very puzzling.

version of nodered? I am on 1.1.2

1 Like

that worked!

2 Likes

I'm trying to pipe HE's logs into NR logging using NR socket listener. I had seen a previous, non NR posting, on setup; of course cant it now...
TIA

Found it: ws://hubip/logsocket

2 Likes

Title - Fan control via inside temp comparison with outside temp check.

Summary - Turns on the ceiling fan above our wood stove when the temperature in that room is +5 degrees warmer then the room next to it (this should only occur if the wood stove is going). If that happens while the outside temp is under 40 degrees; turn on the fan. To prevent my wife getting wind chill in the AM, when the temp difference drops below +3 turn the fan off (the fire is out and the house is equaling off). Thanks to @JasonJoel for the function code help

Flow
[{"id":"d59b8c3c.ba0aa","type":"group","z":"ce2603c5.15dfa","name":"","style":{"fill":"#c8e7a7","label":true},"nodes":["597ac14c.92178","f6c39fa6.83bc1","3a060f2c.44063","c898d1b5.bf791","3ee1303f.32e1e","54a9dc8e.b81ee4","2e361256.600f8e","3af12d48.ed57f2","1963f122.4a5bcf","fb47395b.ed7108","df9d182f.7a15b8","21679210.ef87ae","6a8f0b3e.c399c4"],"x":34,"y":39,"w":1419.0000495910645,"h":201.0000147819519},{"id":"597ac14c.92178","type":"hubitat device","z":"ce2603c5.15dfa","g":"d59b8c3c.ba0aa","name":"Family Room Temp","server":"e56053d2.c7d11","deviceId":"756","attribute":"temperature","sendEvent":true,"x":196.00006866455078,"y":144.0000114440918,"wires":[["3ee1303f.32e1e"]]},{"id":"f6c39fa6.83bc1","type":"switch","z":"ce2603c5.15dfa","g":"d59b8c3c.ba0aa","name":"true/false","property":"payload","propertyType":"msg","rules":[{"t":"cont","v":"true","vt":"str"},{"t":"cont","v":"false","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":825.0001182556152,"y":166.00001525878906,"wires":[["df9d182f.7a15b8"],["21679210.ef87ae"]]},{"id":"3a060f2c.44063","type":"comment","z":"ce2603c5.15dfa","g":"d59b8c3c.ba0aa","name":"🌡️ - Winter Fan On/Off when +5/+3","info":"","x":200,"y":80,"wires":[]},{"id":"c898d1b5.bf791","type":"function","z":"ce2603c5.15dfa","g":"d59b8c3c.ba0aa","name":"Family Room  > Desk +5?","func":"var msg = {};\n\nvar familyroomTemp = flow.get(\"familyroomTemp\")\nvar deskmotionTemp = flow.get(\"deskmotionTemp\");\n\nif (!familyroomTemp || !deskmotionTemp) {\n    return;\n}\n\nif (familyroomTemp > (deskmotionTemp +5)) {\n    msg.payload = true;\n    return msg;\n}\n\nif (familyroomTemp < (deskmotionTemp +3)) {\n    msg.payload = false;\n    return msg;\n}","outputs":1,"noerr":0,"initialize":"","finalize":"","x":641.0000686645508,"y":166.00001335144043,"wires":[["f6c39fa6.83bc1"]]},{"id":"3ee1303f.32e1e","type":"change","z":"ce2603c5.15dfa","g":"d59b8c3c.ba0aa","name":"set familyroomTemp","rules":[{"t":"set","p":"familyroomTemp","pt":"flow","to":"payload.value","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":406.0000686645508,"y":144.0000114440918,"wires":[["c898d1b5.bf791"]]},{"id":"54a9dc8e.b81ee4","type":"hubitat device","z":"ce2603c5.15dfa","g":"d59b8c3c.ba0aa","name":"Office Motion Temp","server":"e56053d2.c7d11","deviceId":"2251","attribute":"temperature","sendEvent":true,"x":196.00006866455078,"y":199.0000147819519,"wires":[["2e361256.600f8e"]]},{"id":"2e361256.600f8e","type":"change","z":"ce2603c5.15dfa","g":"d59b8c3c.ba0aa","name":"set deskmotionTemp","rules":[{"t":"set","p":"deskmotionTemp","pt":"flow","to":"payload.value","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":407.0000686645508,"y":199.0000114440918,"wires":[["c898d1b5.bf791"]]},{"id":"3af12d48.ed57f2","type":"hubitat command","z":"ce2603c5.15dfa","g":"d59b8c3c.ba0aa","name":"Family Room Fan On","server":"e56053d2.c7d11","deviceId":"587","command":"on","commandArgs":"","x":1327.0000495910645,"y":145.0000114440918,"wires":[[]]},{"id":"1963f122.4a5bcf","type":"hubitat command","z":"ce2603c5.15dfa","g":"d59b8c3c.ba0aa","name":"Family Room Fan Off","server":"e56053d2.c7d11","deviceId":"587","command":"off","commandArgs":"","x":1325.0001068115234,"y":186.0000114440918,"wires":[[]]},{"id":"fb47395b.ed7108","type":"switch","z":"ce2603c5.15dfa","g":"d59b8c3c.ba0aa","name":"Below 40?","property":"payload","propertyType":"msg","rules":[{"t":"lt","v":"40","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":1138.0000076293945,"y":137.00000762939453,"wires":[["3af12d48.ed57f2"]]},{"id":"df9d182f.7a15b8","type":"hubitat device","z":"ce2603c5.15dfa","g":"d59b8c3c.ba0aa","name":"OutsideTemp","server":"c8979c8a.67001","deviceId":"161","attribute":"temperature","sendEvent":false,"x":979.0000534057617,"y":140.00001335144043,"wires":[["fb47395b.ed7108"]]},{"id":"21679210.ef87ae","type":"hubitat device","z":"ce2603c5.15dfa","g":"d59b8c3c.ba0aa","name":"OutsideTemp","server":"c8979c8a.67001","deviceId":"161","attribute":"temperature","sendEvent":false,"x":979.0000495910645,"y":190.00001525878906,"wires":[["6a8f0b3e.c399c4"]]},{"id":"6a8f0b3e.c399c4","type":"switch","z":"ce2603c5.15dfa","g":"d59b8c3c.ba0aa","name":"Below 40?","property":"payload","propertyType":"msg","rules":[{"t":"lt","v":"40","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":1139.0000114440918,"y":190.00001335144043,"wires":[["1963f122.4a5bcf"]]},{"id":"e56053d2.c7d11","type":"hubitat config","z":"","name":"Devices Hub","usetls":false,"host":"10.13.9.11","port":"80","appId":"2532","nodeRedServer":"http://10.13.9.28:1880","webhookPath":"/hubitat/webhook__","autoRefresh":true,"useWebsocket":false},{"id":"c8979c8a.67001","type":"hubitat config","z":"","name":"Apps Hub","usetls":false,"host":"10.13.9.12","port":"80","appId":"899","nodeRedServer":"http://10.13.9.28:1880","webhookPath":"/hubitat/webhook___","autoRefresh":true,"useWebsocket":false}]
5 Likes

Title - Outside Light On and Off + Change with Motion

Summary - (this could be better) but I have created my outside light to come on at Dusk at 1% and off at Dawn, in inbetween those times if motion is detected the light goes upto 100% and goes back down to 1% once motion has stopped. This uses node-red-contrib-bigtimer & node-red-contrib-time-range-switch

Picture -

Flow -

Summary

[{"id":"73237910.0a2008","type":"hubitat device","z":"59821e52.c4335","name":"Front Door","server":"89a479f5.5c31e8","deviceId":"164","attribute":"motion","sendEvent":true,"x":90,"y":200,"wires":[["6efa468f.3981c8"]]},{"id":"6efa468f.3981c8","type":"switch","z":"59821e52.c4335","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":300,"y":200,"wires":[["e54b0756.fc7b38"],["72f28de3.e1f6d4"]]},{"id":"6f351f4.c3bdfe","type":"hubitat command","z":"59821e52.c4335","name":"Outside Light 1%","server":"89a479f5.5c31e8","deviceId":"650","command":"setLevel","commandArgs":"1","x":750,"y":220,"wires":[[]]},{"id":"eeb04e1.acb47b","type":"hubitat command","z":"59821e52.c4335","name":"Outside Light Off","server":"89a479f5.5c31e8","deviceId":"650","command":"off","commandArgs":"","x":550,"y":80,"wires":[[]]},{"id":"7c0ff5d9.4e653c","type":"hubitat command","z":"59821e52.c4335","name":"Outside Light On","server":"89a479f5.5c31e8","deviceId":"650","command":"on","commandArgs":"","x":550,"y":40,"wires":[[]]},{"id":"7e96d26c.12185c","type":"switch","z":"59821e52.c4335","name":"On (1) - Off (0)","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"1","vt":"str"},{"t":"eq","v":"0","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":340,"y":80,"wires":[["7c0ff5d9.4e653c"],["eeb04e1.acb47b"]]},{"id":"957b1404.bf00a8","type":"bigtimer","z":"59821e52.c4335","outtopic":"","outpayload1":"","outpayload2":"","name":"Big Timer","comment":"","lat":"52.699219","lon":"-1.367270","starttime":5001,"endtime":"5000","starttime2":0,"endtime2":"0","startoff":0,"endoff":0,"startoff2":0,"endoff2":0,"offs":0,"outtext1":"1","outtext2":"0","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":0,"month7":0,"day8":0,"month8":0,"day9":0,"month9":0,"day10":0,"month10":0,"day11":0,"month11":0,"day12":0,"month12":0,"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":true,"atstart":true,"odd":false,"even":false,"x":100,"y":80,"wires":[["7e96d26c.12185c"],[],["7e96d26c.12185c"]]},{"id":"e54b0756.fc7b38","type":"time-range-switch","z":"59821e52.c4335","name":"","lat":"52.699219","lon":"-1.367270","startTime":"dusk","endTime":"dawn","startOffset":"1","endOffset":"-1","x":530,"y":160,"wires":[["f5fab64c.1a05b8"],[]]},{"id":"72f28de3.e1f6d4","type":"time-range-switch","z":"59821e52.c4335","name":"","lat":"52.699219","lon":"-1.367270","startTime":"dusk","endTime":"dawn","startOffset":0,"endOffset":0,"x":530,"y":240,"wires":[["6f351f4.c3bdfe"],[]]},{"id":"f5fab64c.1a05b8","type":"hubitat command","z":"59821e52.c4335","name":"Outside Light 100%","server":"89a479f5.5c31e8","deviceId":"650","command":"setLevel","commandArgs":"100","x":750,"y":140,"wires":[[]]},{"id":"89a479f5.5c31e8","type":"hubitat config","z":"","name":"AVA","usetls":false,"host":"192.168.4.32","port":"80","appId":"966","nodeRedServer":"http://192.168.2.15:1880","webhookPath":"/hubitat/webhook_","autoRefresh":true,"useWebsocket":false}]

3 Likes

Always room for improvements! If you do please update us, or if someone finds a 'smoother flow' using your idea hopefully they will give back.

I just edited post #2 with some additions that were made. All changes may not be for everyone, but this way we can see and share ideas. Great bonus feature of NR.

In time I hope to organize post #1 index, still pondering the best way to do that.

Figured I'd add an example of a boolean usage, two contacts and one motion sensor control the garage light.

code

[{"id":"b06e26.d529e1d8","type":"hubitat device","z":"3cc9813d.7dcf4e","name":"Garage: Light","server":"f17566a9.c052b8","deviceId":"1043","attribute":"motion","sendEvent":true,"x":100,"y":400,"wires":[["ceeb1404.3c1c48"]]},{"id":"d7ab6ca8.ff371","type":"hubitat device","z":"3cc9813d.7dcf4e","name":"Laundry: Garage door","server":"f17566a9.c052b8","deviceId":"1234","attribute":"contact","sendEvent":true,"x":120,"y":280,"wires":[["fc75782.8dbf888"]]},{"id":"8b6a319.69fdbd","type":"change","z":"3cc9813d.7dcf4e","name":"STOP","rules":[{"t":"set","p":"payload","pt":"msg","to":"STOP","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":910,"y":320,"wires":[["744954f2.a1080c","d536d92f.bc83b8"]]},{"id":"f634bb21.8e6a48","type":"hubitat command","z":"3cc9813d.7dcf4e","name":"Garage: Light","server":"f17566a9.c052b8","deviceId":"1043","command":"off","commandArgs":"","x":1440,"y":380,"wires":[[]]},{"id":"b0cfe18d.ed17a","type":"switch","z":"3cc9813d.7dcf4e","name":"Check on","property":"payload.value","propertyType":"msg","rules":[{"t":"eq","v":"on","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":1280,"y":380,"wires":[["f634bb21.8e6a48"]]},{"id":"306406ee.0e9a1a","type":"hubitat device","z":"3cc9813d.7dcf4e","name":"Garage: Light","server":"f17566a9.c052b8","deviceId":"1043","attribute":"switch","sendEvent":false,"x":1120,"y":380,"wires":[["b0cfe18d.ed17a"]]},{"id":"744954f2.a1080c","type":"stoptimer-varidelay","z":"3cc9813d.7dcf4e","duration":"3","durationType":"num","units":"Minute","payloadtype":"num","payloadval":"0","name":"","reporting":"last_minute_seconds","x":940,"y":380,"wires":[["306406ee.0e9a1a"],[],[]]},{"id":"b0dc2387.ed01e","type":"hubitat device","z":"3cc9813d.7dcf4e","name":"Garage: Garage door","server":"f17566a9.c052b8","deviceId":"179","attribute":"contact","sendEvent":true,"x":120,"y":340,"wires":[["fc75782.8dbf888"]]},{"id":"ceeb1404.3c1c48","type":"change","z":"3cc9813d.7dcf4e","name":"Motion to Bool","rules":[{"t":"set","p":"payload","pt":"msg","to":"msg.payload.value = "active" ? true : false","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":320,"y":400,"wires":[["105677ac.b02e58"]]},{"id":"105677ac.b02e58","type":"BooleanLogicUltimate","z":"3cc9813d.7dcf4e","name":"","filtertrue":"both","persist":true,"sInitializeWith":"false","triggertopic":"trigger","outputtriggeredby":"all","inputCount":"3","topic":"result","x":540,"y":360,"wires":[[],["68f1c340.9f16dc"],[]]},{"id":"fc75782.8dbf888","type":"change","z":"3cc9813d.7dcf4e","name":"Contact to Bool","rules":[{"t":"set","p":"payload","pt":"msg","to":"msg.payload.value = "open" ? true : false","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":340,"y":320,"wires":[["105677ac.b02e58"]]},{"id":"2aa141e9.6a8ebe","type":"hubitat command","z":"3cc9813d.7dcf4e","name":"Garage: Light","server":"f17566a9.c052b8","deviceId":"1043","command":"on","commandArgs":"","x":1440,"y":320,"wires":[[]]},{"id":"685f64ec.e603dc","type":"switch","z":"3cc9813d.7dcf4e","name":"Check on","property":"payload.value","propertyType":"msg","rules":[{"t":"eq","v":"off","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":1280,"y":320,"wires":[["2aa141e9.6a8ebe"]]},{"id":"d536d92f.bc83b8","type":"hubitat device","z":"3cc9813d.7dcf4e","name":"Garage: Light","server":"f17566a9.c052b8","deviceId":"1043","attribute":"switch","sendEvent":false,"x":1120,"y":320,"wires":[["685f64ec.e603dc"]]},{"id":"68f1c340.9f16dc","type":"switch","z":"3cc9813d.7dcf4e","name":"True/False","property":"payload","propertyType":"msg","rules":[{"t":"true"},{"t":"false"}],"checkall":"true","repair":false,"outputs":2,"x":710,"y":360,"wires":[["8b6a319.69fdbd"],["744954f2.a1080c"]]},{"id":"f17566a9.c052b8","type":"hubitat config","z":"","name":"","usetls":false,"host":"192.168.2.3","port":"80","appId":"3424","nodeRedServer":"http://192.168.2.9:1880","webhookPath":"/hubitat/webhook","autoRefresh":true,"useWebsocket":false}]

5 Likes

Here's my spin on motion lighting with dim level adjust. Notice the unconnected (lower left) node. I tried to use actual hall illuminance but the :face_with_symbols_over_mouth: device I was using is so crappy with it's light range and very slow to update so I went back to my previous idea of using the outside light level and assume it means something about the hall light level. When I get a better device installed (like Hubitat with Homemade Temperature, Humidity, Pressure and Light sensor which are excellent BTW) I'll go back to using hall light level.

[{"id":"28cea37b.04605c","type":"tab","label":"Upstairs Hall Motion Lighting with Dim","disabled":false,"info":""},{"id":"1e9560fd.a0617f","type":"hubitat device","z":"28cea37b.04605c","name":"Front Porch Illuminance","server":"5780d46e.3640ac","deviceId":"98","attribute":"illuminance","sendEvent":true,"x":130,"y":80,"wires":[["b61f8098.f0d67","e2f8252c.0f3678"]]},{"id":"b61f8098.f0d67","type":"range","z":"28cea37b.04605c","minin":"0","maxin":"800","minout":"15","maxout":"80","action":"clamp","round":true,"property":"payload.value","name":"Scale Luminance to Dimmer Level","x":460,"y":80,"wires":[["5b42e22d.974abc"]]},{"id":"5b42e22d.974abc","type":"function","z":"28cea37b.04605c","name":"Save Dimmer Level","func":"flow.set(\"dimmer_level\", msg.payload.value);\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":750,"y":80,"wires":[[]]},{"id":"f6b51b14.d16968","type":"hubitat device","z":"28cea37b.04605c","name":"Upstairs Hall Motion","server":"7e632c0e.cc9424","deviceId":"642","attribute":"motion","sendEvent":true,"x":120,"y":240,"wires":[["9671e0c5.21f79","ec2c8101.c6e84"]]},{"id":"ea0899ad.01a438","type":"hubitat device","z":"28cea37b.04605c","name":"Upstairs Hall Illuminace","server":"5780d46e.3640ac","deviceId":"514","attribute":"illuminance","sendEvent":true,"x":130,"y":320,"wires":[[]]},{"id":"ec2c8101.c6e84","type":"gate","z":"28cea37b.04605c","name":"","controlTopic":"control","defaultState":"closed","openCmd":"open","closeCmd":"close","toggleCmd":"toggle","defaultCmd":"default","persist":true,"x":410,"y":160,"wires":[["25c4f2da.c6bc9e","25d61660.1e0fba"]]},{"id":"d99561fa.01f7","type":"hubitat command","z":"28cea37b.04605c","name":"Set Dim Level","server":"7e632c0e.cc9424","deviceId":"194","command":"setLevel","commandArgs":"","x":760,"y":160,"wires":[[]]},{"id":"afa9ebd6.eb5608","type":"hubitat command","z":"28cea37b.04605c","name":"Turn Off","server":"5780d46e.3640ac","deviceId":"194","command":"off","commandArgs":"","x":540,"y":260,"wires":[[]]},{"id":"25c4f2da.c6bc9e","type":"function","z":"28cea37b.04605c","name":"Get Dimmer Level","func":"msg.arguments=flow.get(\"dimmer_level\");\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":570,"y":160,"wires":[["d99561fa.01f7"]]},{"id":"a0b1b4e2.7e4d58","type":"change","z":"28cea37b.04605c","name":"Open Gate","rules":[{"t":"set","p":"payload","pt":"msg","to":"open","tot":"str"},{"t":"set","p":"topic","pt":"msg","to":"control","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":250,"y":140,"wires":[["ec2c8101.c6e84"]]},{"id":"e2f8252c.0f3678","type":"switch","z":"28cea37b.04605c","name":"<= 775","property":"payload.value","propertyType":"msg","rules":[{"t":"lte","v":"775","vt":"num"},{"t":"else"}],"checkall":"true","repair":false,"outputs":2,"x":90,"y":160,"wires":[["a0b1b4e2.7e4d58"],["43a7d485.35c3bc"]]},{"id":"43a7d485.35c3bc","type":"change","z":"28cea37b.04605c","name":"Close Gate","rules":[{"t":"set","p":"payload","pt":"msg","to":"close","tot":"str"},{"t":"set","p":"topic","pt":"msg","to":"control","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":250,"y":180,"wires":[["ec2c8101.c6e84"]]},{"id":"9671e0c5.21f79","type":"trigger","z":"28cea37b.04605c","name":"Delay Off","op1":"","op2":"false","op1type":"nul","op2type":"bool","duration":"2","extend":true,"units":"min","reset":"","bytopic":"all","topic":"topic","outputs":2,"x":340,"y":240,"wires":[[],["afa9ebd6.eb5608"]]},{"id":"25d61660.1e0fba","type":"hubitat command","z":"28cea37b.04605c","name":"Turn On","server":"7e632c0e.cc9424","deviceId":"194","command":"on","commandArgs":"","x":540,"y":220,"wires":[[]]},{"id":"5780d46e.3640ac","type":"hubitat config","z":"","name":"Steve's Hubitat - webhook","usetls":false,"host":"192.168.1.12","port":"80","appId":"545","nodeRedServer":"http://pvr.localdomain:1880","webhookPath":"/hubitat/webhook_","autoRefresh":true,"useWebsocket":false},{"id":"7e632c0e.cc9424","type":"hubitat config","z":"","name":"Steve's Hubitat - websocket","usetls":false,"host":"hubitat.localdomain","port":"80","appId":"545","nodeRedServer":"http://pvr.localdomain:1880","webhookPath":"/hubitat/webhook","autoRefresh":true,"useWebsocket":true}]
1 Like

Need to go find the delay off node!