Node-Red Flow Samples/Sharing

You could use the Delay node, calculate the milliseconds between the current time and event time and pass in the time to wait in msg.delay.

1 Like

That's a great idea however the issue is interpreting the transcribed text that Alexa generates into a numeric value that I can use in an inject node.

I need something like this: "turn the coffee pot on at four thirty nine a.m."

Converted to this: "04:39"

Ouch - that can be a nightmare but I guess you could do it in a complicated function node? How accurate is the transcribed text?

I played around with how to split up the text in a function node based on your example (the current example has "four thirty nine am", but the other cases are just copy paste of the first one and adjust for the spaces) and a sample flow is below:

[{"id":"8590441.9e2cdb8","type":"inject","z":"2140a9d4.13a7fe","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"four thirty nine am","payloadType":"str","x":363.3333435058594,"y":40,"wires":[["d3927e10.0a17"]]},{"id":"d3927e10.0a17","type":"function","z":"2140a9d4.13a7fe","name":"","func":"let timeText = msg.payload\nlet count = 0\nlet position1 = 0\nlet position2 = 0\nlet position3 = 0\nlet position4 = 0\nlet strLength = 0\nlet hour = ''\nlet minutes1 = ''\nlet minutes2 = ''\nlet ampm = ''\n\ncount = timeText.match(/\\s/g||[])\n\nmsg.count = count.length\nstrLength = timeText.length\n\nswitch(count.length){\n    case 3:\n        position1=timeText.indexOf(' ')\n        msg.position1=position1\n        hour = timeText.substring(0,position1)\n        msg.hour = hour\n    \n        position2 = timeText.indexOf(' ',position1+1)\n        minutes1= timeText.substring(position1+1,position2)\n        msg.position2 = position2\n        msg.minutes1 = minutes1\n    \n        position3 = timeText.indexOf(' ',position2+1)\n        minutes2= timeText.substring(position2+1,position3)\n        msg.position3 = position3\n        msg.minutes2 = minutes2\n    \n        amPM = timeText.slice(position3+1,strLength)\n        msg.amPM = amPM\n    break;\n}\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":553.3333129882812,"y":110,"wires":[["4d100b0b.fe1b3c"]]},{"id":"261306c1.8451b2","type":"inject","z":"2140a9d4.13a7fe","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"four thirty am","payloadType":"str","x":356.6666564941406,"y":109.66666412353516,"wires":[["d3927e10.0a17"]]},{"id":"88deeae2.48cfd8","type":"inject","z":"2140a9d4.13a7fe","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"four am","payloadType":"str","x":371.6666564941406,"y":194.6666488647461,"wires":[["d3927e10.0a17"]]},{"id":"4d100b0b.fe1b3c","type":"debug","z":"2140a9d4.13a7fe","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":722.3333435058594,"y":110,"wires":[]}]

You should be able to take this and add a couple of cases to account for some variations in the transcribed text (e.g. four thirty am, four am). Basically the number of spaces determines hour, minutes and am/pm and is used to parse out the text. You can then convert the text to numbers (eg. one = 1, two = 2 etc.)

Hope this helps. Ping me if you need any help.

1 Like

Wow, thanks, that's a great start. I can work with that. This is for my wife as she wakes at varying times for work and I don't feel like editing the flow each time.

Here's five actual speech to text transcriptions using the Alexa node. She was spot on every time. Other than "six oh five", which that's easy enough to change to zero.
turn the coffee pot on at six fifteen a.m.
turn the coffee pot on at four thirty nine a.m.
turn the coffee pot on at four forty five a.m.
turn the coffee pot on at six oh five
turn the coffee pot on at six a.m.

1 Like

Here's my attempt at some AI :smiley: to use Alexa speech to text to interpret the command "Alexa, turn the coffee pot on at; some variable time" within the next 23:59 hours.

This flow will parse the transcribed text of what Alexa hears and turn on the switch at the desired time and then provides a spoken confirmation that the correct time has been set by using the "schedex" node to output it's configured on-time.

@rakeshg gave me some code to split out the various possibilities for spoken time. I've added some filtering to eliminate the possibility that some random phrase could be mistaken for a command to set the time. The text to numbers function was also found online.

[{"id":"b3a78e0918d07187","type":"alexa-remote-event","z":"719a3759c325f79f","name":"","account":"03d5dfd689975b6f","event":"ws-device-activity","x":141,"y":1190,"wires":[["da8e875d86c8e82a"]]},{"id":"da8e875d86c8e82a","type":"match","z":"719a3759c325f79f","name":"","rules":[{"property":"payload.data.intent","propertyType":"msg","type":"eq","value":"TurnOnApplianceIntent","valueType":"str"},{"property":"payload.name","propertyType":"msg","type":"eq","value":"Office","valueType":"str"},{"property":"payload.description.summary","propertyType":"msg","type":"regex","value":"coffee pot|maker","valueType":"str","case":true}],"x":137,"y":1258,"wires":[["f9c3e07ef133d4d3"],[]]},{"id":"f9c3e07ef133d4d3","type":"change","z":"719a3759c325f79f","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.description.summary","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":148,"y":1326,"wires":[["b4c12c470b32b8af"]]},{"id":"b4c12c470b32b8af","type":"string","z":"719a3759c325f79f","name":"Only pass time","methods":[{"name":"delLeftMost","params":[{"type":"str","value":" at "}]},{"name":"trimLeft","params":[]},{"name":"trimRight","params":[]},{"name":"stripPunctuation","params":[]},{"name":"toLowerCase","params":[]}],"prop":"payload","propout":"payload","object":"msg","objectout":"msg","x":388,"y":1190,"wires":[["d3927e10.0a17"]]},{"id":"d3927e10.0a17","type":"function","z":"719a3759c325f79f","name":"Parse msg","func":"let timeText = msg.payload\nlet count = 0\nlet position1 = 0\nlet position2 = 0\nlet position3 = 0\nlet position4 = 0\nlet strLength = 0\nlet hour = ''\nlet minutes1 = ''\nlet minutes2 = ''\nlet ampm = ''\n\ncount = timeText.match(/\\s/g||[])\n\nmsg.count = count.length\nstrLength = timeText.length\n\nswitch(count.length){\n        case 3:\n        position1=timeText.indexOf(' ')\n        //msg.position1=position1\n        hour = timeText.substring(0,position1)\n        msg.hour = hour\n    \n        position2 = timeText.indexOf(' ',position1+1)\n        minutes1= timeText.substring(position1+1,position2)\n        //msg.position2 = position2\n        msg.minutes1 = minutes1\n    \n        position3 = timeText.indexOf(' ',position2+1)\n        minutes2= timeText.substring(position2+1,position3)\n        //msg.position3 = position3\n        msg.minutes2 = minutes2\n    \n        amPM = timeText.slice(position3+1,strLength)\n        msg.amPM = amPM\n    break;\n        case 2:\n        position1=timeText.indexOf(' ')\n        //msg.position1=position1\n        hour = timeText.substring(0,position1)\n        msg.hour = hour\n    \n        position2 = timeText.indexOf(' ',position1+1)\n        minutes1= timeText.substring(position1+1,position2)\n        //msg.position2 = position2\n        msg.minutes1 = minutes1\n    \n        amPM = timeText.slice(position2+1,strLength)\n        msg.amPM = amPM\n    break;\n    case 1:\n        position1=timeText.indexOf(' ')\n        //msg.position1=position1\n        hour = timeText.substring(0,position1)\n        msg.hour = hour\n\n        amPM = timeText.slice(position1+1,strLength)\n        msg.amPM = amPM\n    break;\n}\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":576,"y":1190,"wires":[["e44f10d0334213df"]]},{"id":"e44f10d0334213df","type":"switch","z":"719a3759c325f79f","name":"Only if has AM/PM","property":"amPM","propertyType":"msg","rules":[{"t":"regex","v":"am|pm","vt":"str","case":true}],"checkall":"true","repair":false,"outputs":1,"x":437,"y":1241,"wires":[["760d90e4a88545bd"]]},{"id":"760d90e4a88545bd","type":"switch","z":"719a3759c325f79f","name":"word count","property":"count","propertyType":"msg","rules":[{"t":"eq","v":"1","vt":"num"},{"t":"eq","v":"2","vt":"num"},{"t":"eq","v":"3","vt":"num"}],"checkall":"true","repair":false,"outputs":3,"x":457,"y":1309,"wires":[["2d8a3b5a5284ede3"],["ab40443ba768d134"],["9b80181e34165b14"]]},{"id":"2d8a3b5a5284ede3","type":"Input Split","z":"719a3759c325f79f","name":"One word","inputProps":["hour"],"outputs":1,"x":671,"y":1241,"wires":[["042a98914153f06d"]]},{"id":"ab40443ba768d134","type":"Input Split","z":"719a3759c325f79f","name":"Two word","inputProps":["hour","minutes1"],"outputs":2,"x":671,"y":1275,"wires":[["e7e0dce3b0e89bfe"],["3877414c8af8e847"]]},{"id":"9b80181e34165b14","type":"Input Split","z":"719a3759c325f79f","name":"Three word","inputProps":["hour","minutes1","minutes2"],"outputs":3,"x":678,"y":1326,"wires":[["033a1ed64264fb8d"],["cd98a44478476fd4"],["f5ff95deb0703f4f"]]},{"id":"042a98914153f06d","type":"function","z":"719a3759c325f79f","name":"Text to Numbers","func":"var Small = {\n    'oh' : 0,\n    'zero': 0,\n    'one': 1,\n    'two': 2,\n    'three': 3,\n    'four': 4,\n    'five': 5,\n    'six': 6,\n    'seven': 7,\n    'eight': 8,\n    'nine': 9,\n    'ten': 10,\n    'eleven': 11,\n    'twelve': 12,\n    'thirteen': 13,\n    'fourteen': 14,\n    'fifteen': 15,\n    'sixteen': 16,\n    'seventeen': 17,\n    'eighteen': 18,\n    'nineteen': 19,\n    'twenty': 20,\n    'thirty': 30,\n    'forty': 40,\n    'fifty': 50,\n    'sixty': 60,\n    'seventy': 70,\n    'eighty': 80,\n    'ninety': 90,\n    //'am':' am',\n    //'pm':' pm'\n};\n\nvar Magnitude = {\n    'thousand':     1000,\n    'million':      1000000,\n    'billion':      1000000000,\n    'trillion':     1000000000000,\n    'quadrillion':  1000000000000000,\n    'quintillion':  1000000000000000000,\n    'sextillion':   1000000000000000000000,\n    'septillion':   1000000000000000000000000,\n    'octillion':    1000000000000000000000000000,\n    'nonillion':    1000000000000000000000000000000,\n    'decillion':    1000000000000000000000000000000000,\n};\n\nvar a, n, g;\nvar payload=msg.payload; //get payload\n\nfunction text2num(s) {\n    a = s.toString().split(/[\\s-]+/);\n    n = \"\";\n    //n = 0;\n    g = \"\";\n    //g = 0;\n    a.forEach(feach);\n    return n + g;\n}\n\nfunction feach(w) {\n    var x = Small[w];\n    if (x != null) {\n        g = g + x;\n    }\n    else if (w == \"hundred\") {\n        g = g * 100;\n    }\n    else {\n        x = Magnitude[w];\n        if (x != null) {\n            n = n + g * x\n            g = 0;\n        }\n        else { \n            alert(\"Unknown number: \"+w); \n        }\n    }\n}\nmsg.payload=text2num(payload);\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":889,"y":1173,"wires":[["6af3d5ce81b1db31"]]},{"id":"e7e0dce3b0e89bfe","type":"function","z":"719a3759c325f79f","name":"Text to Numbers","func":"var Small = {\n    'oh' : 0,\n    'zero': 0,\n    'one': 1,\n    'two': 2,\n    'three': 3,\n    'four': 4,\n    'five': 5,\n    'six': 6,\n    'seven': 7,\n    'eight': 8,\n    'nine': 9,\n    'ten': 10,\n    'eleven': 11,\n    'twelve': 12,\n    'thirteen': 13,\n    'fourteen': 14,\n    'fifteen': 15,\n    'sixteen': 16,\n    'seventeen': 17,\n    'eighteen': 18,\n    'nineteen': 19,\n    'twenty': 20,\n    'thirty': 30,\n    'forty': 40,\n    'fifty': 50,\n    'sixty': 60,\n    'seventy': 70,\n    'eighty': 80,\n    'ninety': 90,\n    'am':' am',\n    'pm':' pm'\n};\n\nvar Magnitude = {\n    'thousand':     1000,\n    'million':      1000000,\n    'billion':      1000000000,\n    'trillion':     1000000000000,\n    'quadrillion':  1000000000000000,\n    'quintillion':  1000000000000000000,\n    'sextillion':   1000000000000000000000,\n    'septillion':   1000000000000000000000000,\n    'octillion':    1000000000000000000000000000,\n    'nonillion':    1000000000000000000000000000000,\n    'decillion':    1000000000000000000000000000000000,\n};\n\nvar a, n, g;\nvar payload=msg.payload; //get payload\n\nfunction text2num(s) {\n    a = s.toString().split(/[\\s-]+/);\n    n = \"\";\n    //n = 0;\n    g = \"\";\n    //g = 0;\n    a.forEach(feach);\n    return n + g;\n}\n\nfunction feach(w) {\n    var x = Small[w];\n    if (x != null) {\n        g = g + x;\n    }\n    else if (w == \"hundred\") {\n        g = g * 100;\n    }\n    else {\n        x = Magnitude[w];\n        if (x != null) {\n            n = n + g * x\n            g = 0;\n        }\n        else { \n            alert(\"Unknown number: \"+w); \n        }\n    }\n}\nmsg.payload=text2num(payload);\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":889,"y":1224,"wires":[["7c4384669d451c6e"]]},{"id":"3877414c8af8e847","type":"function","z":"719a3759c325f79f","name":"Text to Numbers","func":"var Small = {\n    'oh' : 0,\n    'zero': 0,\n    'one': 1,\n    'two': 2,\n    'three': 3,\n    'four': 4,\n    'five': 5,\n    'six': 6,\n    'seven': 7,\n    'eight': 8,\n    'nine': 9,\n    'ten': 10,\n    'eleven': 11,\n    'twelve': 12,\n    'thirteen': 13,\n    'fourteen': 14,\n    'fifteen': 15,\n    'sixteen': 16,\n    'seventeen': 17,\n    'eighteen': 18,\n    'nineteen': 19,\n    'twenty': 20,\n    'thirty': 30,\n    'forty': 40,\n    'fifty': 50,\n    'sixty': 60,\n    'seventy': 70,\n    'eighty': 80,\n    'ninety': 90,\n    'am':' am',\n    'pm':' pm'\n};\n\nvar Magnitude = {\n    'thousand':     1000,\n    'million':      1000000,\n    'billion':      1000000000,\n    'trillion':     1000000000000,\n    'quadrillion':  1000000000000000,\n    'quintillion':  1000000000000000000,\n    'sextillion':   1000000000000000000000,\n    'septillion':   1000000000000000000000000,\n    'octillion':    1000000000000000000000000000,\n    'nonillion':    1000000000000000000000000000000,\n    'decillion':    1000000000000000000000000000000000,\n};\n\nvar a, n, g;\nvar payload=msg.payload; //get payload\n\nfunction text2num(s) {\n    a = s.toString().split(/[\\s-]+/);\n    n = \"\";\n    //n = 0;\n    g = \"\";\n    //g = 0;\n    a.forEach(feach);\n    return n + g;\n}\n\nfunction feach(w) {\n    var x = Small[w];\n    if (x != null) {\n        g = g + x;\n    }\n    else if (w == \"hundred\") {\n        g = g * 100;\n    }\n    else {\n        x = Magnitude[w];\n        if (x != null) {\n            n = n + g * x\n            g = 0;\n        }\n        else { \n            alert(\"Unknown number: \"+w); \n        }\n    }\n}\nmsg.payload=text2num(payload);\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":889,"y":1258,"wires":[["7c4384669d451c6e"]]},{"id":"033a1ed64264fb8d","type":"function","z":"719a3759c325f79f","name":"Text to Numbers","func":"var Small = {\n    'oh' : 0,\n    'zero': 0,\n    'one': 1,\n    'two': 2,\n    'three': 3,\n    'four': 4,\n    'five': 5,\n    'six': 6,\n    'seven': 7,\n    'eight': 8,\n    'nine': 9,\n    'ten': 10,\n    'eleven': 11,\n    'twelve': 12,\n    'thirteen': 13,\n    'fourteen': 14,\n    'fifteen': 15,\n    'sixteen': 16,\n    'seventeen': 17,\n    'eighteen': 18,\n    'nineteen': 19,\n    'twenty': 20,\n    'thirty': 30,\n    'forty': 40,\n    'fifty': 50,\n    'sixty': 60,\n    'seventy': 70,\n    'eighty': 80,\n    'ninety': 90,\n    'am':' am',\n    'pm':' pm'\n};\n\nvar Magnitude = {\n    'thousand':     1000,\n    'million':      1000000,\n    'billion':      1000000000,\n    'trillion':     1000000000000,\n    'quadrillion':  1000000000000000,\n    'quintillion':  1000000000000000000,\n    'sextillion':   1000000000000000000000,\n    'septillion':   1000000000000000000000000,\n    'octillion':    1000000000000000000000000000,\n    'nonillion':    1000000000000000000000000000000,\n    'decillion':    1000000000000000000000000000000000,\n};\n\nvar a, n, g;\nvar payload=msg.payload; //get payload\n\nfunction text2num(s) {\n    a = s.toString().split(/[\\s-]+/);\n    n = \"\";\n    //n = 0;\n    g = \"\";\n    //g = 0;\n    a.forEach(feach);\n    return n + g;\n}\n\nfunction feach(w) {\n    var x = Small[w];\n    if (x != null) {\n        g = g + x;\n    }\n    else if (w == \"hundred\") {\n        g = g * 100;\n    }\n    else {\n        x = Magnitude[w];\n        if (x != null) {\n            n = n + g * x\n            g = 0;\n        }\n        else { \n            alert(\"Unknown number: \"+w); \n        }\n    }\n}\nmsg.payload=text2num(payload);\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":889,"y":1309,"wires":[["c28a24fe51c76127"]]},{"id":"cd98a44478476fd4","type":"function","z":"719a3759c325f79f","name":"Text to Numbers","func":"var Small = {\n    'oh' : 0,\n    'zero': 0,\n    'one': 1,\n    'two': 2,\n    'three': 3,\n    'four': 4,\n    'five': 5,\n    'six': 6,\n    'seven': 7,\n    'eight': 8,\n    'nine': 9,\n    'ten': 10,\n    'eleven': 11,\n    'twelve': 12,\n    'thirteen': 13,\n    'fourteen': 14,\n    'fifteen': 15,\n    'sixteen': 16,\n    'seventeen': 17,\n    'eighteen': 18,\n    'nineteen': 19,\n    'twenty': 20,\n    'thirty': 30,\n    'forty': 40,\n    'fifty': 50,\n    'sixty': 60,\n    'seventy': 70,\n    'eighty': 80,\n    'ninety': 90,\n    'am':' am',\n    'pm':' pm'\n};\n\nvar Magnitude = {\n    'thousand':     1000,\n    'million':      1000000,\n    'billion':      1000000000,\n    'trillion':     1000000000000,\n    'quadrillion':  1000000000000000,\n    'quintillion':  1000000000000000000,\n    'sextillion':   1000000000000000000000,\n    'septillion':   1000000000000000000000000,\n    'octillion':    1000000000000000000000000000,\n    'nonillion':    1000000000000000000000000000000,\n    'decillion':    1000000000000000000000000000000000,\n};\n\nvar a, n, g;\nvar payload=msg.payload; //get payload\n\nfunction text2num(s) {\n    a = s.toString().split(/[\\s-]+/);\n    n = \"\";\n    //n = 0;\n    g = \"\";\n    //g = 0;\n    a.forEach(feach);\n    return n + g;\n}\n\nfunction feach(w) {\n    var x = Small[w];\n    if (x != null) {\n        g = g + x;\n    }\n    else if (w == \"hundred\") {\n        g = g * 100;\n    }\n    else {\n        x = Magnitude[w];\n        if (x != null) {\n            n = n + g * x\n            g = 0;\n        }\n        else { \n            alert(\"Unknown number: \"+w); \n        }\n    }\n}\nmsg.payload=text2num(payload);\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":889,"y":1343,"wires":[["c28a24fe51c76127"]]},{"id":"f5ff95deb0703f4f","type":"function","z":"719a3759c325f79f","name":"Text to Numbers","func":"var Small = {\n    'oh' : 0,\n    'zero': 0,\n    'one': 1,\n    'two': 2,\n    'three': 3,\n    'four': 4,\n    'five': 5,\n    'six': 6,\n    'seven': 7,\n    'eight': 8,\n    'nine': 9,\n    'ten': 10,\n    'eleven': 11,\n    'twelve': 12,\n    'thirteen': 13,\n    'fourteen': 14,\n    'fifteen': 15,\n    'sixteen': 16,\n    'seventeen': 17,\n    'eighteen': 18,\n    'nineteen': 19,\n    'twenty': 20,\n    'thirty': 30,\n    'forty': 40,\n    'fifty': 50,\n    'sixty': 60,\n    'seventy': 70,\n    'eighty': 80,\n    'ninety': 90,\n    'am':' am',\n    'pm':' pm'\n};\n\nvar Magnitude = {\n    'thousand':     1000,\n    'million':      1000000,\n    'billion':      1000000000,\n    'trillion':     1000000000000,\n    'quadrillion':  1000000000000000,\n    'quintillion':  1000000000000000000,\n    'sextillion':   1000000000000000000000,\n    'septillion':   1000000000000000000000000,\n    'octillion':    1000000000000000000000000000,\n    'nonillion':    1000000000000000000000000000000,\n    'decillion':    1000000000000000000000000000000000,\n};\n\nvar a, n, g;\nvar payload=msg.payload; //get payload\n\nfunction text2num(s) {\n    a = s.toString().split(/[\\s-]+/);\n    n = \"\";\n    //n = 0;\n    g = \"\";\n    //g = 0;\n    a.forEach(feach);\n    return n + g;\n}\n\nfunction feach(w) {\n    var x = Small[w];\n    if (x != null) {\n        g = g + x;\n    }\n    else if (w == \"hundred\") {\n        g = g * 100;\n    }\n    else {\n        x = Magnitude[w];\n        if (x != null) {\n            n = n + g * x\n            g = 0;\n        }\n        else { \n            alert(\"Unknown number: \"+w); \n        }\n    }\n}\nmsg.payload=text2num(payload);\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":889,"y":1377,"wires":[["c28a24fe51c76127"]]},{"id":"6af3d5ce81b1db31","type":"template","z":"719a3759c325f79f","name":"","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"{{payload}}:00 {{amPM}}","output":"str","x":1079,"y":1173,"wires":[["42921e2a01feb911"]]},{"id":"7c4384669d451c6e","type":"join","z":"719a3759c325f79f","name":"","mode":"custom","build":"array","property":"payload","propertyType":"msg","key":"","joiner":"\\n","joinerType":"str","accumulate":false,"timeout":"","count":"2","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"num","reduceFixup":"","x":1070,"y":1241,"wires":[["e71a603c631dfcd0"]]},{"id":"c28a24fe51c76127","type":"join","z":"719a3759c325f79f","name":"","mode":"custom","build":"array","property":"payload","propertyType":"msg","key":"topic","joiner":"\\n","joinerType":"str","accumulate":false,"timeout":"","count":"3","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":1070,"y":1343,"wires":[["8ff84037ac52b37d"]]},{"id":"42921e2a01feb911","type":"function","z":"719a3759c325f79f","name":"convert to 24hr","func":"const convertTime = timeStr => {\n   const [time, modifier] = timeStr.split(' ');\n   let [hours, minutes] = time.split(':');\n   if (hours === '12') {\n      hours = '00';\n   }\n   if (modifier === 'pm') {\n      hours = parseInt(hours, 10) + 12;\n   }\n   return `${hours}:${minutes}`;\n};\nmsg.payload=(convertTime(msg.payload));\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1450,"y":1173,"wires":[["2451bf41bb4aa412"]]},{"id":"e71a603c631dfcd0","type":"function","z":"719a3759c325f79f","name":"Format time string","func":"msg.payload = msg.payload[0] + \":\" + msg.payload[1] + \" \" + msg.amPM;\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1229,"y":1241,"wires":[["42921e2a01feb911"]]},{"id":"8ff84037ac52b37d","type":"function","z":"719a3759c325f79f","name":"Format time string","func":"combinedMinutes = parseFloat(msg.payload[1]) + parseFloat(msg.payload[2]);\nif (combinedMinutes < 10) { combinedMinutes = \"0\" + combinedMinutes;}\nmsg.payload = msg.payload[0] + \":\" + combinedMinutes + \" \" + msg.amPM;\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1229,"y":1343,"wires":[["42921e2a01feb911"]]},{"id":"2451bf41bb4aa412","type":"change","z":"719a3759c325f79f","name":"On/Off Times","rules":[{"t":"move","p":"payload","pt":"msg","to":"payload.ontime","tot":"msg"},{"t":"set","p":"payload.offtime","pt":"msg","to":"","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1630,"y":1173,"wires":[["c6c6f9eb2ccb0cff","a9fd416b360fd507"]]},{"id":"c6c6f9eb2ccb0cff","type":"schedex","z":"719a3759c325f79f","name":"","passthroughunhandled":false,"suspended":false,"lat":"41.2414404191641","lon":"-80.78194611847465","ontime":"","ontopic":"","onpayload":"on","onoffset":0,"onrandomoffset":0,"offtime":"","offtopic":"","offpayload":"off","offoffset":0,"offrandomoffset":0,"mon":true,"tue":true,"wed":true,"thu":true,"fri":true,"sat":true,"sun":true,"x":1444,"y":1309,"wires":[["452fbd38efca09f9"]]},{"id":"a9fd416b360fd507","type":"delay","z":"719a3759c325f79f","name":"","pauseType":"delay","timeout":"2","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"allowrate":false,"outputs":1,"x":1453,"y":1241,"wires":[["92415ec33bf6ce84"]]},{"id":"92415ec33bf6ce84","type":"change","z":"719a3759c325f79f","name":"Annouce Info","rules":[{"t":"set","p":"payload","pt":"msg","to":"info","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1609,"y":1241,"wires":[["c6c6f9eb2ccb0cff"]]},{"id":"452fbd38efca09f9","type":"switch","z":"719a3759c325f79f","name":"","property":"topic","propertyType":"msg","rules":[{"t":"eq","v":"","vt":"str"},{"t":"eq","v":"info","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":1565,"y":1309,"wires":[["65cf77e34efe93c1"],["ab76cbaea42b2486"]]},{"id":"65cf77e34efe93c1","type":"Tasmota Switch","z":"719a3759c325f79f","broker":"f02b0b101445e38b","device":"teckin1","name":"","outputs":1,"uidisabler":false,"fullTopic":"","cmndPrefix":"","statPrefix":"","telePrefix":"","qos":1,"retain":false,"x":1743,"y":1309,"wires":[[]]},{"id":"ab76cbaea42b2486","type":"moment","z":"719a3759c325f79f","name":"","topic":"","input":"payload.on","inputType":"msg","inTz":"Europe/London","adjAmount":0,"adjType":"days","adjDir":"add","format":"dddd h:mm a","locale":"en-US","output":"payload","outputType":"msg","outTz":"America/New_York","x":1362,"y":1394,"wires":[["238986dd8627c5e2"]]},{"id":"238986dd8627c5e2","type":"template","z":"719a3759c325f79f","name":"","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"The coffee maker will turn on {{payload}} !","output":"str","x":1556,"y":1394,"wires":[["8e397e21b858ef69"]]},{"id":"8e397e21b858ef69","type":"alexa-remote-routine","z":"719a3759c325f79f","name":"","account":"03d5dfd689975b6f","routineNode":{"type":"speak","payload":{"type":"regular","text":{"type":"msg","value":"payload"},"devices":["abf53d7765f04fe6bdf3e159e2841cda"]}},"x":1722,"y":1394,"wires":[[]]},{"id":"03d5dfd689975b6f","type":"alexa-remote-account","name":"Mkuzenko-Amazon","authMethod":"proxy","proxyOwnIp":"192.168.0.2","proxyPort":"3456","cookieFile":"/home/mint/Documents/NodeRedData/applestrudel.txt","refreshInterval":"3","alexaServiceHost":"pitangui.amazon.com","amazonPage":"amazon.com","acceptLanguage":"en-US","onKeywordInLanguage":"on","userAgent":"","useWsMqtt":"on","autoInit":"on"},{"id":"f02b0b101445e38b","type":"tasmota-mqtt-broker","name":"Tasmota MQTT","broker":"192.168.0.2","port":"1883","clientid":"","usetls":false,"keepalive":"60","cleansession":true}]
2 Likes

FYI - at least Pico double-taps will be supported by the platform in the next release ...

1 Like

That's cool to know!

I believe my subflow takes doubletap events into account so can continue to trap Pico triple-tap events.. :wink:

1 Like

What is the best practice to store configuration that are needed across multiple flows? I have several flows that do things like reboot/shutdown the HE hubs, download backups, and gather performance metrics and store those in a MariaDB database. In each of these flows I have function nodes that set variables with hub details like IP Address, name, etc. I recently replaced my Asus router with UDM and realized I had a ton of hard coded IP addresses, etc baked within my flows and hoping to come up with a better way to manage this.

Thoughts?

I'm not sure I understand you exactly, but I store settings as global variables because those are available across flows. I also use disk storage for all my global variables and most of my flow variables, so they survive across node-red restarts.

2 Likes

Two things, one you could use global context variables to store common hub details, etc.
https://nodered.org/docs/user-guide/context

Or two, for functions that are repeated (shutdown or startup for example) you could either make a subflow for that and then just have a single place to adjust it trickling down to every instance of that subflow, or you can have only a single instance of that sequence and then use link-in and link-out nodes as necessary to trigger that sequence from another flow.

1 Like

Like @aaiyar said - store configuration values in global variables. I don't use disk storage for context stores (I probably should) since I don't store current state or value (they are fixed values), instead I have a flow that executes on Node-RED startup that re-populates all the variables.

2 Likes

Basically I have a function node that sets IP Address and Hub Name that I then use in http request nodes. I have one for each of my 5 hubs and this is utilized on several flows thus repeating the same information vs ideally having a global variable with a Map/Object that I can set once and reference.

Pardon my noob question as I am really not using NR that much, how do you accomplish this?

Again noob question but how to you setup a flow that does this on startup?

Thanks in advance!

1 Like

Global variables are ideal for what you wish to do. And if you store them on disk, you can recover them easily after restarting NR (or any other time).

The node-red documentation has a section called "Working with Context", linked to by @cjkeenan above. Here's the relevant bit - you'll have to edit settings.js and restart start NR to make the change permanent.

2 Likes

On the "Inject" node, check "Inject once after XX" like this and it will trigger the flow after Node-RED restarts.

EDIT:
Here is an example of setting URLs that I use for my Tesla Powerwall. In this case, all my related flows are on the same flow-editor page, so I use flow variables vs global.

[{"id":"eeb7f918.374db8","type":"group","z":"2b6c3ed9.22a7ea","style":{"stroke":"#999999","stroke-opacity":"1","fill":"none","fill-opacity":"1","label":true,"label-position":"nw","color":"#a4a4a4"},"nodes":["c4581dd4e58dcbe2","4e72725.41b548c","bd511a64.3209b"],"x":32.666595458984375,"y":21,"w":503.6667175292969,"h":135.99999618530273},{"id":"c4581dd4e58dcbe2","type":"comment","z":"2b6c3ed9.22a7ea","g":"eeb7f918.374db8","name":"Set Flow Variables","info":"","x":148.66659545898438,"y":62,"wires":[]},{"id":"4e72725.41b548c","type":"inject","z":"2b6c3ed9.22a7ea","g":"eeb7f918.374db8","name":"Initialize Flow Variables","props":[{"p":"payload"}],"repeat":"","crontab":"","once":true,"onceDelay":"0.2","topic":"","payload":"","payloadType":"date","x":189.33331298828125,"y":115.99999618530273,"wires":[["bd511a64.3209b"]]},{"id":"bd511a64.3209b","type":"change","z":"2b6c3ed9.22a7ea","g":"eeb7f918.374db8","name":"Set Flow Variables","rules":[{"t":"set","p":"socURL","pt":"flow","to":"192.168.1.123/api/system_status/soe","tot":"str"},{"t":"set","p":"aggregatesURL","pt":"flow","to":"192.168.1.123/api/meters/aggregates","tot":"str"},{"t":"set","p":"loginURL","pt":"flow","to":"192.168.1.123/api/login/Basic","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":420.33331298828125,"y":115.66665267944336,"wires":[[]]}]
3 Likes

So I like watching the whole SpaceX Starship thing down in Boca Chica, TX. Periodically (far too often) watch the 24/7 youtube livestreams from Lab Padre & NasaSpaceFlight Now!

Trouble is the ongoing activity is mostly boring punctuated with bouts of excitement here and there. Instead of having youtube up and running constantly I decided to create this simple subflow that parses the video page and extracts the number of people watching.

I set a threshold value that sets a property when it's exceeded. I then send myself an email when triggered or when it falls below. The idea is more people watching means a higher probability that something is going on.

Here is a basic example:

YouTube - "Watching Now" Count Subflow

[{"id":"bb498e1f93af0410","type":"subflow","name":"YT Watching Now","info":"","category":"","in":[{"x":50,"y":30,"wires":[{"id":"6c862a9df27e9568"}]}],"out":[{"x":1240,"y":300,"wires":[{"id":"0fc72446cbd9f29c","port":0},{"id":"3bcfae689e861aed","port":1}]}],"env":[{"name":"TITLE","type":"str","value":"YouTube Video Title"},{"name":"YT_VIDEO","type":"str","value":"mhJRzQsLZGg"},{"name":"THRESHOLD","type":"num","value":"1200"},{"name":"FILTER_OUTPUT","type":"bool","value":"true"}],"meta":{},"color":"#DDAA99","status":{"x":820,"y":300,"wires":[{"id":"a28cd78c8940c521","port":1},{"id":"875c4bbb68746856","port":1}]}},{"id":"875c4bbb68746856","type":"function","z":"bb498e1f93af0410","name":"Set return message based on current watchers","func":"//msg.payload = parseInt(msg.payload);\nvar currentWatchers = parseInt(msg.payload);\nvar threshold = env.get(\"THRESHOLD\");\nvar title = env.get(\"TITLE\");\nmsg.payload = currentWatchers;\n\nvar status = {};\n\nvar retMsg = {\n    \"topic\": title\n    ,\"result\": {\n        \"title\": title\n        ,\"watching\": currentWatchers\n        ,\"lastChecked\": Date.now().toString()\n        ,\"url\": \"https://www.youtube.com/watch?v=\" + env.get(\"YT_VIDEO\")\n    }\n}\n\nif (currentWatchers < threshold ) {\n    retMsg.result.status = \"Stand Down\";\n    retMsg.payload = \"Stand Down\";\n    retMsg.result.thresholdExceeded = false;\n    status.payload = {fill:\"blue\",shape:\"dot\",text: \"watching: \" + currentWatchers.toString()};\n} else {\n    retMsg.result.status = \"Go Time\";\n    retMsg.payload = \"Go Time\";\n    retMsg.result.thresholdExceeded = true;\n    status.payload = {fill:\"green\",shape:\"dot\",text: \"watching: \" + currentWatchers.toString()};\n}\n\nreturn [retMsg,status];","outputs":2,"noerr":0,"initialize":"","finalize":"","libs":[],"x":540,"y":160,"wires":[["3bcfae689e861aed"],[]]},{"id":"a28cd78c8940c521","type":"exec","z":"bb498e1f93af0410","command":"","addpay":"payload","append":"","useSpawn":"false","timer":"","winHide":false,"oldrc":false,"name":"","x":170,"y":160,"wires":[["875c4bbb68746856"],[],[]]},{"id":"d930ec2b502229ff","type":"template","z":"bb498e1f93af0410","name":"","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"curl -s https://www.youtube.com/watch?v={{payload}}  | egrep -o '\\{\\\"text\\\":\\\"[0-9]+\\\"\\},\\{\\\"text\\\":\\\" watching now\\\"\\}' | uniq | egrep -o '[0-9]+'\n\n","output":"str","x":420,"y":80,"wires":[["a28cd78c8940c521"]]},{"id":"6c862a9df27e9568","type":"change","z":"bb498e1f93af0410","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"YT_VIDEO","tot":"env"},{"t":"set","p":"topic","pt":"msg","to":"TITLE","tot":"env"}],"action":"","property":"","from":"","to":"","reg":false,"x":200,"y":80,"wires":[["d930ec2b502229ff"]]},{"id":"0fc72446cbd9f29c","type":"rbe","z":"bb498e1f93af0410","name":"","func":"rbe","gap":"","start":"","inout":"out","septopics":true,"property":"payload","topi":"topic","x":1130,"y":160,"wires":[[]]},{"id":"3bcfae689e861aed","type":"switch","z":"bb498e1f93af0410","name":"Filter Results?","property":"FILTER_OUTPUT","propertyType":"env","rules":[{"t":"true"},{"t":"false"}],"checkall":"true","repair":false,"outputs":2,"x":880,"y":160,"wires":[["0fc72446cbd9f29c"],[]]},{"id":"3380589835de6dc8","type":"subflow:bb498e1f93af0410","z":"b38ec3180db9ae33","name":"NSF - Starbase LIVE","env":[{"name":"TITLE","value":"NSF - Starbase LIVE","type":"str"},{"name":"ALERT_ON_VIEWS","value":"3000","type":"num"}],"x":620,"y":1420,"wires":[["eae0098a839ead94"]]},{"id":"3787abc870511012","type":"change","z":"b38ec3180db9ae33","name":"","rules":[{"t":"set","p":"topic","pt":"msg","to":"\"Might want to check out \" & result.title & \"!\"","tot":"jsonata"},{"t":"set","p":"payload","pt":"msg","to":"\"With \" & result.watching \t& \" people watching something seems to be up.\"\t& \"\\n\"\t& \"\\n\"\t& \"check out: \\n\" & result.url\t\t\t","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":1100,"y":1380,"wires":[["9d77587398b17aef"]]},{"id":"f119c6cadd41f2ba","type":"change","z":"b38ec3180db9ae33","name":"","rules":[{"t":"set","p":"topic","pt":"msg","to":"result.title & \" is now calm with only \" & result.watching & \" people watching.\"","tot":"jsonata"},{"t":"set","p":"payload","pt":"msg","to":"\"Nothing going on just yet. Check back later.\"\t& \"\\n\"\t& \"\\n\"\t& result.url\t","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":1100,"y":1460,"wires":[["d82e6da02db85487"]]},{"id":"d82e6da02db85487","type":"debug","z":"b38ec3180db9ae33","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":1270,"y":1460,"wires":[]},{"id":"9d77587398b17aef","type":"debug","z":"b38ec3180db9ae33","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":1270,"y":1380,"wires":[]},{"id":"eae0098a839ead94","type":"switch","z":"b38ec3180db9ae33","name":"thresholdExceeded true?","property":"result.thresholdExceeded","propertyType":"msg","rules":[{"t":"true"},{"t":"false"}],"checkall":"true","repair":false,"outputs":2,"x":870,"y":1420,"wires":[["3787abc870511012"],["f119c6cadd41f2ba"]]},{"id":"809081c3c00e7e5b","type":"inject","z":"b38ec3180db9ae33","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":420,"y":1420,"wires":[["3380589835de6dc8"]]}]

Notes:

  • This uses the "Exec" node with curl.. had difficulty trying to get this to work with the HTTP nodes.

  • Will probably lose the threshold value as the checking can be done outside the subflow via the raw watcher count. Will possibly add some kind of averaging/ smoothing option.. but that might not be necessary if you keep the checking interval on the longish side - 10 minutes or more.

  • This can be used for any youtube video not just Starship

  • For more rocket fun checkout @JustinL's "Lift Off" HE device driver... very cool.
    [RELEASE] Lift Off --> Space-X Launch Schedule Integration

3 Likes

Quick update to the above subflow... it did not handle commas in the reported numbers. Decided to leave the threshold check in for now.

Here is the latest (this node instance example points to NSF Live):

YouTube - Watching Now 1.1.0

[{"id":"bb498e1f93af0410","type":"subflow","name":"YT Watching Now","info":"","category":"","in":[{"x":50,"y":30,"wires":[{"id":"6c862a9df27e9568"}]}],"out":[{"x":1240,"y":300,"wires":[{"id":"0fc72446cbd9f29c","port":0},{"id":"3bcfae689e861aed","port":1}]}],"env":[{"name":"TITLE","type":"str","value":"YouTube Video Title"},{"name":"YT_VIDEO","type":"str","value":"mhJRzQsLZGg"},{"name":"THRESHOLD","type":"num","value":"1200"},{"name":"FILTER_OUTPUT","type":"bool","value":"true"}],"meta":{"version":"1.1.0","desc":"Scrape \"watching now\" value from YouTube streams"},"color":"#DDAA99","status":{"x":820,"y":300,"wires":[{"id":"875c4bbb68746856","port":1},{"id":"6886ed8ff0326333","port":0}]}},{"id":"875c4bbb68746856","type":"function","z":"bb498e1f93af0410","name":"Set return message based on current watchers","func":"//msg.payload = parseInt(msg.payload);\nvar currentWatchers = parseInt(msg.payload);\n//var currentWatchers = 5000;\nvar threshold = env.get(\"THRESHOLD\");\nvar title = env.get(\"TITLE\");\nmsg.payload = currentWatchers;\n\nvar status = {};\nvar retMsg = {\n    \"topic\": title\n    ,\"result\": {\n        \"title\": title\n        ,\"watching\": currentWatchers\n        ,\"lastChecked\": Date.now().toString()\n        ,\"url\": \"https://www.youtube.com/watch?v=\" + env.get(\"YT_VIDEO\")\n    }\n}\n\nif (!isNaN(currentWatchers)) {\n    if (currentWatchers < threshold ) {\n        retMsg.result.status = \"Stand Down\";\n        retMsg.payload = \"Stand Down\";\n        retMsg.result.thresholdExceeded = false;\n        status.payload = {fill:\"blue\",shape:\"dot\",text: \"watching: \" + currentWatchers.toString()};\n    } else {\n        retMsg.result.status = \"Go Time\";\n        retMsg.payload = \"Go Time\";\n        retMsg.result.thresholdExceeded = true;\n        status.payload = {fill:\"green\",shape:\"dot\",text: \"watching: \" + currentWatchers.toString()};\n    }\n    node.send([retMsg,status]);\n}\n\nreturn;","outputs":2,"noerr":0,"initialize":"","finalize":"","libs":[],"x":540,"y":160,"wires":[["3bcfae689e861aed"],[]]},{"id":"a28cd78c8940c521","type":"exec","z":"bb498e1f93af0410","command":"","addpay":"payload","append":"","useSpawn":"false","timer":"","winHide":false,"oldrc":false,"name":"","x":170,"y":160,"wires":[["875c4bbb68746856"],[],["5f69170f12ca817e"]]},{"id":"d930ec2b502229ff","type":"template","z":"bb498e1f93af0410","name":"","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"curl -s https://www.youtube.com/watch?v={{payload}} | egrep -o '\\{\\\"text\\\":\\\"[0-9][0-9,]+\\\"\\},\\{\\\"text\\\":\\\" watching now\\\"\\}' | uniq | egrep -o '[0-9][0-9,]+'  | sed 's/[,]//'\n\n","output":"str","x":420,"y":80,"wires":[["a28cd78c8940c521"]]},{"id":"6c862a9df27e9568","type":"change","z":"bb498e1f93af0410","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"YT_VIDEO","tot":"env"},{"t":"set","p":"topic","pt":"msg","to":"TITLE","tot":"env"}],"action":"","property":"","from":"","to":"","reg":false,"x":200,"y":80,"wires":[["d930ec2b502229ff"]]},{"id":"0fc72446cbd9f29c","type":"rbe","z":"bb498e1f93af0410","name":"","func":"rbe","gap":"","start":"","inout":"out","septopics":true,"property":"payload","topi":"topic","x":1130,"y":160,"wires":[[]]},{"id":"3bcfae689e861aed","type":"switch","z":"bb498e1f93af0410","name":"Filter Results?","property":"FILTER_OUTPUT","propertyType":"env","rules":[{"t":"true"},{"t":"false"}],"checkall":"true","repair":false,"outputs":2,"x":880,"y":160,"wires":[["0fc72446cbd9f29c"],[]]},{"id":"6886ed8ff0326333","type":"change","z":"bb498e1f93af0410","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"{\t   \"fill\":\"red\",\t   \"shape\":\"dot\",\t   \"text\": ( payload.code = 1 ? \"Stream Unavailable\" : \"Unknown Error\" )\t}","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":600,"y":300,"wires":[[]]},{"id":"5f69170f12ca817e","type":"switch","z":"bb498e1f93af0410","name":"","property":"payload.code","propertyType":"msg","rules":[{"t":"neq","v":"0","vt":"num"}],"checkall":"true","repair":false,"outputs":1,"x":410,"y":300,"wires":[["6886ed8ff0326333"]]},{"id":"52596f85517d818f","type":"subflow:bb498e1f93af0410","z":"b38ec3180db9ae33","name":"NSF - Starbase LIVE","env":[{"name":"TITLE","value":"NSF - Starbase LIVE","type":"str"},{"name":"THRESHOLD","value":"3000","type":"num"},{"name":"ALERT_ON_VIEWS","value":"3000","type":"num"}],"x":500,"y":680,"wires":[["bd4e12c456eb339e"]]}]

3 Likes

Self moderating from this thread - [BETA] Tesla Vehicle via TeslaMate MQTT

If you guys are going to this level of effort just to get a Tesla into Hubitat (not to mention additional hardware), I would highly recommend just biting the bullet and transitioning into node-red automation. It really opens up a bunch of new possibilities.

Things like:

  • Checking to see if the car is locked and locking it if it's not at bedtime (it also yells at me if it's not plugged in, but you can do that without node-red).
  • Tying it to Google calendar to preconditioning it before I go somewhere (super awesome in Chicago winters).
  • For unscheduled trips - I can just ask Google Home to warm up the car without pulling out my phone.

Just saying! I love tempting people down the same rabbit holes I've been sucked into. :grinning:

GottaMakeItDifferentGottaMakeItDifferentGottaMakeItDifferentGottaMakeItDifferentGottaMakeItDifferentGottaMakeItDifferentGottaMakeItDifferentGottaMakeItDifferentGottaMakeItDifferentGottaMakeItDifferent

2 Likes

I agree with this..

When using community apps and drivers the thing you have to be careful with HE is resource overhead. Going to a separate rules controller like NR helps reduce memory consumption etc. Also since you have more control over the NR environment you can add storage / memory as necessary.

For my home system I am now running HomeAssistant with the NR addon as a new companion server. Both HA and NR offer some nice capabilities while HE handles all the Zigbee/Z-Wave/Lutron devices and some cool additional system services like Alexa.

1 Like

:exploding_head: Me too. I think there needs to be a beginner edition. Call it Node-Green.

I haven't see this posted anywhere before... Alexa voice commands for lighting with dynamic timers. For example, "Alexa, turn on the living room lights for 20 minutes." Or, "Alexa, turn off the lights for 45 seconds." Or even, "Alexa, disable office motion for 1 hour."

So, after creating some lighting flows with my motion sensors, I realized they often turned the lights off more quickly than I wanted, or kept them on longer than I wanted. Somewhere I found a flow that allowed me to disable the motion sensors whenever I gave a voice command to turn on the lights, but that still didn't really cut it for a variety of reasons. I got the idea of dynamic timers using Alexa voice commands and after a bunch of searching around I came across @stephen_nutt's post here at #116 (thank you kind sir!) After tinkering with his flows I came up with this...

There are essentially two different methods at play here. One is using "on" and "off" hubitat command nodes for my light groups. The other is on the other side of the link-out nodes where I use @yadomi/node-red-contrib-philipshue-events to take care of my lighting. Here is an example...

The reason for two methods is because I was originally using Hue Magic to control everything, but as luck would have it, it stopped working. So, I've been slowly converting everything over to method two as I have time. Frankly, once you figure it out, the philipshue-events method is way better than Hue Magic.

I've only been at this home automation thing for a few weeks, and I whipped this first flow out in the last three or four hours, so I'm sure it could use some work. I wanted to get it out though because I thought people might be interested in this particular application of using Alexa to turn on light groups with dynamic timers.

Besides the contrib mentioned above, these flows use node-red-contrib-stoptimer-varidelay, node-red-contrib-ecolect, node-red-contrib-alexa-remote2-applestrudel, and node-red-contrib-boolean-logic-ultimate. I should also mention these flows were created in Node-RED 3.0 beta 3. If anyone has any questions, suggestions or wants more information, please hit me up.

EDIT: One limitation I've discovered is the timer will only work for the last command you gave Alexa. So, if you told her to turn on your living room lights for an hour and then during that hour, told her to turn on your kitchen lights for 5 minutes, it will reset the timer to 5 minutes.

[
    {
        "id": "25bc6f35f2a44cb7",
        "type": "tab",
        "label": "Flow 9",
        "disabled": false,
        "info": "",
        "env": []
    },
    {
        "id": "65e8c3c1e958d3ea",
        "type": "group",
        "z": "25bc6f35f2a44cb7",
        "style": {
            "stroke": "#000000",
            "label": true,
            "fill": "#addb7b",
            "color": "#000000"
        },
        "nodes": [
            "98a49fe9e4e49101",
            "04a0a024d2811afd",
            "f1190985f2bc844f",
            "be315601ea68f849",
            "93ccf8606e4db7ec",
            "8f79b7c924abff02",
            "6bcdbfe69cafb699",
            "f629d61ac9189375",
            "baec9cd6f13d2225",
            "9be4a146ec75a4a7",
            "04562dfaf46c5bf3",
            "ed0794686d944bf3",
            "86f54ac3daaf7768",
            "e826ee85e975ffa4",
            "84ff480ae5725c14",
            "b072027c6d1d6e64",
            "8f7f56ba872e61f0",
            "6e1f8cc4f1ab07e0",
            "a8f3dd512cfb7be4",
            "919572594d214e9a"
        ],
        "x": 188,
        "y": 574,
        "w": 1444,
        "h": 1052
    },
    {
        "id": "a8f3dd512cfb7be4",
        "type": "group",
        "z": "25bc6f35f2a44cb7",
        "g": "65e8c3c1e958d3ea",
        "name": "Alexa Local Light Voice Control ",
        "style": {
            "stroke": "#000000",
            "fill": "#bfdbef",
            "label": true,
            "color": "#000000"
        },
        "nodes": [
            "f547e027474194f6",
            "a27c511addeda301",
            "15adfeaf0f1dcb7a",
            "1a4c9334cd28463e",
            "2eef74b5af789246",
            "0c68db52072968f3",
            "0c6a84a9b1dadc54",
            "6f4ae984d0fb9410",
            "966b3c2392432a60",
            "6b5aeb1c80fc63eb",
            "05a0037e8e57b876",
            "eae5abcd46cb1c12",
            "62cfa8a173b8235d",
            "ba28246ca58d1781",
            "370756c64ae1a442",
            "626bd71df581ea5a",
            "6c0c3bf8a453a80c",
            "1b64c986a124f861",
            "5d43fb69a17a6eef",
            "4630e3f5d44bdf5b"
        ],
        "x": 214,
        "y": 899,
        "w": 1392,
        "h": 409.5
    },
    {
        "id": "8f7f56ba872e61f0",
        "type": "junction",
        "z": "25bc6f35f2a44cb7",
        "g": "65e8c3c1e958d3ea",
        "x": 1220,
        "y": 600,
        "wires": [
            [
                "f1190985f2bc844f"
            ]
        ]
    },
    {
        "id": "6e1f8cc4f1ab07e0",
        "type": "junction",
        "z": "25bc6f35f2a44cb7",
        "g": "65e8c3c1e958d3ea",
        "x": 1220,
        "y": 1600,
        "wires": [
            [
                "8f79b7c924abff02"
            ]
        ]
    },
    {
        "id": "eae5abcd46cb1c12",
        "type": "junction",
        "z": "25bc6f35f2a44cb7",
        "g": "a8f3dd512cfb7be4",
        "x": 1200,
        "y": 940,
        "wires": [
            [
                "966b3c2392432a60"
            ]
        ]
    },
    {
        "id": "1b64c986a124f861",
        "type": "junction",
        "z": "25bc6f35f2a44cb7",
        "g": "a8f3dd512cfb7be4",
        "x": 560,
        "y": 1160,
        "wires": [
            [
                "f547e027474194f6",
                "15adfeaf0f1dcb7a"
            ]
        ]
    },
    {
        "id": "98a49fe9e4e49101",
        "type": "switch",
        "z": "25bc6f35f2a44cb7",
        "g": "65e8c3c1e958d3ea",
        "name": "Voice Commands",
        "property": "payload.description.summary",
        "propertyType": "msg",
        "rules": [
            {
                "t": "cont",
                "v": "turn on",
                "vt": "str"
            },
            {
                "t": "cont",
                "v": "lights on",
                "vt": "str"
            }
        ],
        "checkall": "true",
        "repair": false,
        "outputs": 2,
        "x": 850,
        "y": 760,
        "wires": [
            [
                "04a0a024d2811afd"
            ],
            [
                "04a0a024d2811afd"
            ]
        ]
    },
    {
        "id": "04a0a024d2811afd",
        "type": "switch",
        "z": "25bc6f35f2a44cb7",
        "g": "65e8c3c1e958d3ea",
        "name": "Which Device?",
        "property": "payload.deviceSerialNumber",
        "propertyType": "msg",
        "rules": [
            {
                "t": "eq",
                "v": "Alexa Serial Number Here",
                "vt": "str"
            },
            {
                "t": "eq",
                "v": "Alexa Serial Number Here",
                "vt": "str"
            },
            {
                "t": "eq",
                "v": "Alexa Serial Number Here",
                "vt": "str"
            },
            {
                "t": "eq",
                "v": "Alexa Serial Number Here",
                "vt": "str"
            },
            {
                "t": "eq",
                "v": "Alexa Serial Number Here",
                "vt": "str"
            },
            {
                "t": "eq",
                "v": "Alexa Serial Number Here",
                "vt": "str"
            },
            {
                "t": "eq",
                "v": "Alexa Serial Number Here",
                "vt": "str"
            },
            {
                "t": "eq",
                "v": "Alexa Serial Number Here",
                "vt": "str"
            },
            {
                "t": "eq",
                "v": "Alexa Serial Number Here",
                "vt": "str"
            }
        ],
        "checkall": "true",
        "repair": false,
        "outputs": 9,
        "x": 1080,
        "y": 760,
        "wires": [
            [
                "8f7f56ba872e61f0"
            ],
            [
                "8f7f56ba872e61f0",
                "be315601ea68f849",
                "86f54ac3daaf7768"
            ],
            [
                "8f7f56ba872e61f0"
            ],
            [
                "8f7f56ba872e61f0",
                "f629d61ac9189375"
            ],
            [
                "8f7f56ba872e61f0",
                "e826ee85e975ffa4"
            ],
            [
                "8f7f56ba872e61f0",
                "86f54ac3daaf7768",
                "be315601ea68f849"
            ],
            [
                "8f7f56ba872e61f0",
                "9be4a146ec75a4a7"
            ],
            [
                "8f7f56ba872e61f0"
            ],
            [
                "8f7f56ba872e61f0"
            ]
        ],
        "outputLabels": [
            "Bedroom Echo",
            "Family Room Echo",
            "Garage Echo",
            "Guest Room Echo",
            "Hallway Echo",
            "Kitchen Echo",
            "Living Room Echo",
            "Master Bath Echo",
            "Office Echo"
        ]
    },
    {
        "id": "f1190985f2bc844f",
        "type": "debug",
        "z": "25bc6f35f2a44cb7",
        "g": "65e8c3c1e958d3ea",
        "name": "debug 515",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": true,
        "complete": "true",
        "targetType": "full",
        "statusVal": "payload",
        "statusType": "auto",
        "x": 1070,
        "y": 640,
        "wires": []
    },
    {
        "id": "be315601ea68f849",
        "type": "hubitat command",
        "z": "25bc6f35f2a44cb7",
        "g": "65e8c3c1e958d3ea",
        "deviceLabel": "",
        "name": "",
        "server": "",
        "deviceId": "",
        "command": "",
        "commandArgs": "",
        "x": 1520,
        "y": 620,
        "wires": [
            []
        ]
    },
    {
        "id": "93ccf8606e4db7ec",
        "type": "switch",
        "z": "25bc6f35f2a44cb7",
        "g": "65e8c3c1e958d3ea",
        "name": "Which Device?",
        "property": "payload.deviceSerialNumber",
        "propertyType": "msg",
        "rules": [
            {
                "t": "eq",
                "v": "Alexa Serial Number Here",
                "vt": "str"
            },
            {
                "t": "eq",
                "v": "Alexa Serial Number Here",
                "vt": "str"
            },
            {
                "t": "eq",
                "v": "Alexa Serial Number Here",
                "vt": "str"
            },
            {
                "t": "eq",
                "v": "Alexa Serial Number Here",
                "vt": "str"
            },
            {
                "t": "eq",
                "v": "Alexa Serial Number Here",
                "vt": "str"
            },
            {
                "t": "eq",
                "v": "Alexa Serial Number Here",
                "vt": "str"
            },
            {
                "t": "eq",
                "v": "Alexa Serial Number Here",
                "vt": "str"
            },
            {
                "t": "eq",
                "v": "Alexa Serial Number Here",
                "vt": "str"
            },
            {
                "t": "eq",
                "v": "Alexa Serial Number Here",
                "vt": "str"
            }
        ],
        "checkall": "true",
        "repair": false,
        "outputs": 9,
        "x": 1080,
        "y": 1440,
        "wires": [
            [
                "6e1f8cc4f1ab07e0"
            ],
            [
                "6e1f8cc4f1ab07e0",
                "6bcdbfe69cafb699",
                "ed0794686d944bf3"
            ],
            [
                "6e1f8cc4f1ab07e0"
            ],
            [
                "6e1f8cc4f1ab07e0",
                "baec9cd6f13d2225"
            ],
            [
                "6e1f8cc4f1ab07e0",
                "84ff480ae5725c14"
            ],
            [
                "6e1f8cc4f1ab07e0",
                "ed0794686d944bf3",
                "6bcdbfe69cafb699"
            ],
            [
                "6e1f8cc4f1ab07e0",
                "04562dfaf46c5bf3"
            ],
            [
                "6e1f8cc4f1ab07e0"
            ],
            [
                "6e1f8cc4f1ab07e0"
            ]
        ],
        "outputLabels": [
            "Bedroom Echo",
            "Family Room Echo",
            "Garage Echo",
            "Guest Room Echo",
            "Hallway Echo",
            "Kitchen Echo",
            "Living Room Echo",
            "Master Bath Echo",
            "Office Echo"
        ]
    },
    {
        "id": "8f79b7c924abff02",
        "type": "debug",
        "z": "25bc6f35f2a44cb7",
        "g": "65e8c3c1e958d3ea",
        "name": "debug 516",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": true,
        "complete": "true",
        "targetType": "full",
        "statusVal": "payload",
        "statusType": "auto",
        "x": 1070,
        "y": 1560,
        "wires": []
    },
    {
        "id": "6bcdbfe69cafb699",
        "type": "hubitat command",
        "z": "25bc6f35f2a44cb7",
        "g": "65e8c3c1e958d3ea",
        "deviceLabel": "",
        "name": "",
        "server": "",
        "deviceId": "",
        "command": "",
        "commandArgs": "",
        "x": 1520,
        "y": 1340,
        "wires": [
            []
        ]
    },
    {
        "id": "f629d61ac9189375",
        "type": "hubitat command",
        "z": "25bc6f35f2a44cb7",
        "g": "65e8c3c1e958d3ea",
        "deviceLabel": "",
        "name": "",
        "server": "",
        "deviceId": "",
        "command": "",
        "commandArgs": "",
        "x": 1520,
        "y": 680,
        "wires": [
            []
        ]
    },
    {
        "id": "baec9cd6f13d2225",
        "type": "hubitat command",
        "z": "25bc6f35f2a44cb7",
        "g": "65e8c3c1e958d3ea",
        "deviceLabel": "",
        "name": "",
        "server": "",
        "deviceId": "",
        "command": "",
        "commandArgs": "",
        "x": 1520,
        "y": 1400,
        "wires": [
            []
        ]
    },
    {
        "id": "9be4a146ec75a4a7",
        "type": "hubitat command",
        "z": "25bc6f35f2a44cb7",
        "g": "65e8c3c1e958d3ea",
        "deviceLabel": "",
        "name": "",
        "server": "",
        "deviceId": "",
        "command": "",
        "commandArgs": "",
        "x": 1520,
        "y": 860,
        "wires": [
            []
        ]
    },
    {
        "id": "04562dfaf46c5bf3",
        "type": "hubitat command",
        "z": "25bc6f35f2a44cb7",
        "g": "65e8c3c1e958d3ea",
        "deviceLabel": "",
        "name": "",
        "server": "",
        "deviceId": "",
        "command": "",
        "commandArgs": "",
        "x": 1520,
        "y": 1580,
        "wires": [
            []
        ]
    },
    {
        "id": "ed0794686d944bf3",
        "type": "hubitat command",
        "z": "25bc6f35f2a44cb7",
        "g": "65e8c3c1e958d3ea",
        "deviceLabel": "",
        "name": "",
        "server": "",
        "deviceId": "",
        "command": "",
        "commandArgs": "",
        "x": 1520,
        "y": 1520,
        "wires": [
            []
        ]
    },
    {
        "id": "86f54ac3daaf7768",
        "type": "hubitat command",
        "z": "25bc6f35f2a44cb7",
        "g": "65e8c3c1e958d3ea",
        "deviceLabel": "",
        "name": "",
        "server": "",
        "deviceId": "",
        "command": "",
        "commandArgs": "",
        "x": 1520,
        "y": 800,
        "wires": [
            []
        ]
    },
    {
        "id": "e826ee85e975ffa4",
        "type": "hubitat command",
        "z": "25bc6f35f2a44cb7",
        "g": "65e8c3c1e958d3ea",
        "deviceLabel": "",
        "name": "",
        "server": "",
        "deviceId": "",
        "command": "",
        "commandArgs": "",
        "x": 1520,
        "y": 740,
        "wires": [
            []
        ]
    },
    {
        "id": "84ff480ae5725c14",
        "type": "hubitat command",
        "z": "25bc6f35f2a44cb7",
        "g": "65e8c3c1e958d3ea",
        "deviceLabel": "",
        "name": "",
        "server": "",
        "deviceId": "",
        "command": "",
        "commandArgs": "",
        "x": 1520,
        "y": 1460,
        "wires": [
            []
        ]
    },
    {
        "id": "b072027c6d1d6e64",
        "type": "switch",
        "z": "25bc6f35f2a44cb7",
        "g": "65e8c3c1e958d3ea",
        "name": "Voice Commands",
        "property": "payload.description.summary",
        "propertyType": "msg",
        "rules": [
            {
                "t": "cont",
                "v": "lights off",
                "vt": "str"
            },
            {
                "t": "cont",
                "v": "turn off",
                "vt": "str"
            }
        ],
        "checkall": "true",
        "repair": false,
        "outputs": 2,
        "x": 850,
        "y": 1440,
        "wires": [
            [
                "93ccf8606e4db7ec"
            ],
            [
                "93ccf8606e4db7ec"
            ]
        ]
    },
    {
        "id": "f547e027474194f6",
        "type": "change",
        "z": "25bc6f35f2a44cb7",
        "g": "a8f3dd512cfb7be4",
        "name": "set numbers",
        "rules": [
            {
                "t": "change",
                "p": "values.number",
                "pt": "msg",
                "from": "one",
                "fromt": "str",
                "to": "1",
                "tot": "num"
            },
            {
                "t": "change",
                "p": "values.number",
                "pt": "msg",
                "from": "two",
                "fromt": "str",
                "to": "2",
                "tot": "num"
            },
            {
                "t": "change",
                "p": "values.number",
                "pt": "msg",
                "from": "three",
                "fromt": "str",
                "to": "3",
                "tot": "num"
            },
            {
                "t": "change",
                "p": "values.number",
                "pt": "msg",
                "from": "four",
                "fromt": "str",
                "to": "4",
                "tot": "num"
            },
            {
                "t": "change",
                "p": "values.number",
                "pt": "msg",
                "from": "five",
                "fromt": "str",
                "to": "5",
                "tot": "num"
            },
            {
                "t": "change",
                "p": "values.number",
                "pt": "msg",
                "from": "six",
                "fromt": "str",
                "to": "6",
                "tot": "num"
            },
            {
                "t": "change",
                "p": "values.number",
                "pt": "msg",
                "from": "seven",
                "fromt": "str",
                "to": "7",
                "tot": "num"
            },
            {
                "t": "change",
                "p": "values.number",
                "pt": "msg",
                "from": "eight",
                "fromt": "str",
                "to": "8",
                "tot": "num"
            },
            {
                "t": "change",
                "p": "values.number",
                "pt": "msg",
                "from": "nine",
                "fromt": "str",
                "to": "9",
                "tot": "num"
            },
            {
                "t": "change",
                "p": "values.number",
                "pt": "msg",
                "from": "ten",
                "fromt": "str",
                "to": "10",
                "tot": "num"
            },
            {
                "t": "change",
                "p": "values.number",
                "pt": "msg",
                "from": "fifteen",
                "fromt": "str",
                "to": "15",
                "tot": "num"
            },
            {
                "t": "change",
                "p": "values.number",
                "pt": "msg",
                "from": "twenty",
                "fromt": "str",
                "to": "20",
                "tot": "num"
            },
            {
                "t": "change",
                "p": "values.number",
                "pt": "msg",
                "from": "thirty",
                "fromt": "str",
                "to": "30",
                "tot": "num"
            },
            {
                "t": "change",
                "p": "values.number",
                "pt": "msg",
                "from": "fourty",
                "fromt": "str",
                "to": "40",
                "tot": "num"
            },
            {
                "t": "change",
                "p": "values.number",
                "pt": "msg",
                "from": "fifty",
                "fromt": "str",
                "to": "50",
                "tot": "num"
            },
            {
                "t": "change",
                "p": "values.number",
                "pt": "msg",
                "from": "sixty",
                "fromt": "str",
                "to": "60",
                "tot": "num"
            },
            {
                "t": "set",
                "p": "delay",
                "pt": "msg",
                "to": "values.number",
                "tot": "msg"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 670,
        "y": 1160,
        "wires": [
            [
                "1a4c9334cd28463e"
            ]
        ]
    },
    {
        "id": "a27c511addeda301",
        "type": "stoptimer-varidelay",
        "z": "25bc6f35f2a44cb7",
        "g": "a8f3dd512cfb7be4",
        "duration": "60",
        "durationType": "num",
        "units": "Minute",
        "payloadtype": "str",
        "payloadval": "off",
        "name": "",
        "reporting": "last_minute_seconds",
        "persist": true,
        "ignoretimerpass": false,
        "x": 940,
        "y": 1260,
        "wires": [
            [
                "05a0037e8e57b876",
                "93ccf8606e4db7ec"
            ],
            [],
            []
        ]
    },
    {
        "id": "15adfeaf0f1dcb7a",
        "type": "change",
        "z": "25bc6f35f2a44cb7",
        "g": "a8f3dd512cfb7be4",
        "name": "set units",
        "rules": [
            {
                "t": "set",
                "p": "units",
                "pt": "msg",
                "to": "values.units",
                "tot": "msg"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 680,
        "y": 1240,
        "wires": [
            [
                "1a4c9334cd28463e"
            ]
        ]
    },
    {
        "id": "1a4c9334cd28463e",
        "type": "join",
        "z": "25bc6f35f2a44cb7",
        "g": "a8f3dd512cfb7be4",
        "name": "",
        "mode": "custom",
        "build": "array",
        "property": "payload",
        "propertyType": "msg",
        "key": "topic",
        "joiner": "\\n",
        "joinerType": "str",
        "accumulate": false,
        "timeout": "",
        "count": "2",
        "reduceRight": false,
        "reduceExp": "",
        "reduceInit": "",
        "reduceInitType": "",
        "reduceFixup": "",
        "x": 810,
        "y": 1200,
        "wires": [
            [
                "a27c511addeda301"
            ]
        ]
    },
    {
        "id": "2eef74b5af789246",
        "type": "ecolect",
        "z": "25bc6f35f2a44cb7",
        "g": "a8f3dd512cfb7be4",
        "name": "Voice Commands for Lighting",
        "topics": [
            {
                "name": "lights",
                "phrases": "turn {state} the {item} for {number} {units}\nturn {state} the {item} in the {area} for {number} {units}\nturn {state} the {item} in the {area}\n{state} {item}\n{item}{state}\nturn {state} the {area} {item} for {number} {units}\nturn {state} the {area} {item} \nturn {state} the {item} in the {area}\nturn {state} the {item} in the {area} for {number} {units}\n",
                "values": [
                    {
                        "name": "item",
                        "type": "enumeration",
                        "enumerations": [
                            "lights",
                            "light",
                            "motion",
                            "motion sensors",
                            "sensors"
                        ]
                    },
                    {
                        "name": "units",
                        "type": "enumeration",
                        "enumerations": [
                            "seconds",
                            "minutes",
                            "hours"
                        ]
                    },
                    {
                        "name": "state",
                        "type": "enumeration",
                        "enumerations": [
                            "on",
                            "off",
                            "disable",
                            "enable",
                            "activate",
                            "deactivate"
                        ]
                    },
                    {
                        "name": "number",
                        "type": "enumeration",
                        "enumerations": [
                            "one",
                            "two",
                            "three",
                            "four",
                            "five",
                            "six",
                            "seven",
                            "eight",
                            "nine",
                            "ten",
                            "eleven",
                            "twelve",
                            "thirteen",
                            "fourteen",
                            "fifteen",
                            "sixteen",
                            "seventeen",
                            "eighteen",
                            "ninteen",
                            "twenty",
                            "twenty-one",
                            "twenty-two",
                            "twenty-three",
                            "twenty-four",
                            "twenty-five",
                            "thirty",
                            "fourty",
                            "fourty-five",
                            "fifty",
                            "sixty"
                        ]
                    },
                    {
                        "name": "area",
                        "type": "enumeration",
                        "enumerations": [
                            "bathroom",
                            "bedroom",
                            "dining room",
                            "entryway",
                            "family room",
                            "garage",
                            "guest room",
                            "hallway",
                            "kitchen",
                            "laundry room",
                            "living room",
                            "master bathroom",
                            "master bath",
                            "office",
                            "outside"
                        ]
                    }
                ]
            }
        ],
        "outputs": 2,
        "x": 650,
        "y": 1080,
        "wires": [
            [
                "0c6a84a9b1dadc54",
                "1b64c986a124f861"
            ],
            []
        ]
    },
    {
        "id": "0c68db52072968f3",
        "type": "change",
        "z": "25bc6f35f2a44cb7",
        "g": "a8f3dd512cfb7be4",
        "name": "set payload from summary",
        "rules": [
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "payload.description.summary",
                "tot": "msg"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 480,
        "y": 1020,
        "wires": [
            [
                "2eef74b5af789246"
            ]
        ]
    },
    {
        "id": "0c6a84a9b1dadc54",
        "type": "change",
        "z": "25bc6f35f2a44cb7",
        "g": "a8f3dd512cfb7be4",
        "name": "set state",
        "rules": [
            {
                "t": "change",
                "p": "values.state",
                "pt": "msg",
                "from": "on",
                "fromt": "str",
                "to": "true",
                "tot": "bool"
            },
            {
                "t": "change",
                "p": "values.state",
                "pt": "msg",
                "from": "off",
                "fromt": "str",
                "to": "false",
                "tot": "bool"
            },
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "values.state",
                "tot": "msg"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 920,
        "y": 1040,
        "wires": [
            [
                "6f4ae984d0fb9410"
            ]
        ]
    },
    {
        "id": "6f4ae984d0fb9410",
        "type": "switch",
        "z": "25bc6f35f2a44cb7",
        "g": "a8f3dd512cfb7be4",
        "name": "Room/Area",
        "property": "values.area",
        "propertyType": "msg",
        "rules": [
            {
                "t": "eq",
                "v": "bathroom",
                "vt": "str"
            },
            {
                "t": "eq",
                "v": "bedroom",
                "vt": "str"
            },
            {
                "t": "eq",
                "v": "dining room",
                "vt": "str"
            },
            {
                "t": "eq",
                "v": "entryway",
                "vt": "str"
            },
            {
                "t": "eq",
                "v": "family room",
                "vt": "str"
            },
            {
                "t": "eq",
                "v": "garage",
                "vt": "str"
            },
            {
                "t": "eq",
                "v": "guest room",
                "vt": "str"
            },
            {
                "t": "eq",
                "v": "hallway",
                "vt": "str"
            },
            {
                "t": "eq",
                "v": "kitchen",
                "vt": "str"
            },
            {
                "t": "eq",
                "v": "laundry",
                "vt": "str"
            },
            {
                "t": "eq",
                "v": "living room",
                "vt": "str"
            },
            {
                "t": "eq",
                "v": "master bath",
                "vt": "str"
            },
            {
                "t": "eq",
                "v": "office",
                "vt": "str"
            },
            {
                "t": "eq",
                "v": "outside",
                "vt": "str"
            }
        ],
        "checkall": "true",
        "repair": false,
        "outputs": 14,
        "x": 1090,
        "y": 1080,
        "wires": [
            [
                "eae5abcd46cb1c12"
            ],
            [
                "eae5abcd46cb1c12",
                "370756c64ae1a442"
            ],
            [
                "eae5abcd46cb1c12"
            ],
            [
                "eae5abcd46cb1c12",
                "6b5aeb1c80fc63eb"
            ],
            [
                "eae5abcd46cb1c12"
            ],
            [
                "eae5abcd46cb1c12",
                "626bd71df581ea5a"
            ],
            [
                "eae5abcd46cb1c12"
            ],
            [
                "eae5abcd46cb1c12",
                "6c0c3bf8a453a80c"
            ],
            [
                "eae5abcd46cb1c12"
            ],
            [
                "eae5abcd46cb1c12",
                "62cfa8a173b8235d"
            ],
            [
                "eae5abcd46cb1c12"
            ],
            [
                "eae5abcd46cb1c12"
            ],
            [
                "eae5abcd46cb1c12",
                "ba28246ca58d1781"
            ],
            [
                "eae5abcd46cb1c12"
            ]
        ],
        "outputLabels": [
            "Bathroom",
            "Bedroom",
            "Dining Room",
            "Entryway",
            "Family Room",
            "Garage",
            "Guest Room",
            "Hallway",
            "Kitchen",
            "Laundry Room",
            "Living Room",
            "Master Bath",
            "Office",
            "Outside"
        ]
    },
    {
        "id": "966b3c2392432a60",
        "type": "debug",
        "z": "25bc6f35f2a44cb7",
        "g": "a8f3dd512cfb7be4",
        "name": "debug 517",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": true,
        "complete": "true",
        "targetType": "full",
        "statusVal": "payload",
        "statusType": "auto",
        "x": 1310,
        "y": 940,
        "wires": []
    },
    {
        "id": "6b5aeb1c80fc63eb",
        "type": "link out",
        "z": "25bc6f35f2a44cb7",
        "g": "a8f3dd512cfb7be4",
        "name": "Entryway Lights",
        "mode": "link",
        "links": [
            "1cbe1d67bbf89d7c"
        ],
        "x": 1500,
        "y": 1020,
        "wires": [],
        "icon": "node-red/light.svg",
        "l": true
    },
    {
        "id": "05a0037e8e57b876",
        "type": "change",
        "z": "25bc6f35f2a44cb7",
        "g": "a8f3dd512cfb7be4",
        "name": "set state",
        "rules": [
            {
                "t": "change",
                "p": "values.state",
                "pt": "msg",
                "from": "on",
                "fromt": "str",
                "to": "false",
                "tot": "bool"
            },
            {
                "t": "change",
                "p": "values.state",
                "pt": "msg",
                "from": "off",
                "fromt": "str",
                "to": "true",
                "tot": "bool"
            },
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "values.state",
                "tot": "msg"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 920,
        "y": 1120,
        "wires": [
            [
                "6f4ae984d0fb9410"
            ]
        ]
    },
    {
        "id": "62cfa8a173b8235d",
        "type": "link out",
        "z": "25bc6f35f2a44cb7",
        "g": "a8f3dd512cfb7be4",
        "name": "Laundry Room Lights",
        "mode": "link",
        "links": [
            "2d4d225366c81a39"
        ],
        "x": 1480,
        "y": 1200,
        "wires": [],
        "icon": "node-red/light.svg",
        "l": true
    },
    {
        "id": "ba28246ca58d1781",
        "type": "link out",
        "z": "25bc6f35f2a44cb7",
        "g": "a8f3dd512cfb7be4",
        "name": "Office Lights",
        "mode": "link",
        "links": [
            "e127b95333e569fd",
            "27f951496da4f276",
            "5445e96a55d1da7f",
            "a03c0d4ba6e71fda"
        ],
        "x": 1510,
        "y": 1260,
        "wires": [],
        "icon": "node-red/light.svg",
        "l": true
    },
    {
        "id": "370756c64ae1a442",
        "type": "link out",
        "z": "25bc6f35f2a44cb7",
        "g": "a8f3dd512cfb7be4",
        "name": "Bedroom Lights",
        "mode": "link",
        "links": [
            "21ebd38950e29f43",
            "5c8badb0bd0992fe"
        ],
        "x": 1500,
        "y": 960,
        "wires": [],
        "icon": "node-red/light.svg",
        "l": true
    },
    {
        "id": "626bd71df581ea5a",
        "type": "link out",
        "z": "25bc6f35f2a44cb7",
        "g": "a8f3dd512cfb7be4",
        "name": "Garage Lights",
        "mode": "link",
        "links": [],
        "x": 1500,
        "y": 1080,
        "wires": [],
        "icon": "node-red/light.svg",
        "l": true
    },
    {
        "id": "6c0c3bf8a453a80c",
        "type": "link out",
        "z": "25bc6f35f2a44cb7",
        "g": "a8f3dd512cfb7be4",
        "name": "Hallway Lights",
        "mode": "link",
        "links": [
            "2d4d225366c81a39",
            "a7e452d41c38e273"
        ],
        "x": 1500,
        "y": 1140,
        "wires": [],
        "icon": "node-red/light.svg",
        "l": true
    },
    {
        "id": "5d43fb69a17a6eef",
        "type": "alexa-remote-event",
        "z": "25bc6f35f2a44cb7",
        "g": "a8f3dd512cfb7be4",
        "name": "",
        "account": "",
        "event": "ws-device-activity",
        "x": 330,
        "y": 1080,
        "wires": [
            [
                "98a49fe9e4e49101",
                "b072027c6d1d6e64",
                "0c68db52072968f3"
            ]
        ]
    },
    {
        "id": "919572594d214e9a",
        "type": "comment",
        "z": "25bc6f35f2a44cb7",
        "g": "65e8c3c1e958d3ea",
        "name": "Regarding Hubitat Command Nodes",
        "info": "You will need ot add your own device info into\nthe command nodes. The top row are \"on\" nodes\nthe bottom row are \"off\" nodes.",
        "x": 1100,
        "y": 860,
        "wires": []
    },
    {
        "id": "4630e3f5d44bdf5b",
        "type": "comment",
        "z": "25bc6f35f2a44cb7",
        "g": "a8f3dd512cfb7be4",
        "name": "Conenct your alexa account here",
        "info": "Details for how to set this up can be found \nin the contrib",
        "x": 370,
        "y": 960,
        "wires": []
    }
]
3 Likes