Node-Red Flow Samples/Sharing

Title Office scenes with PC control

Summary -
Part 1 - Work Alarm turns mode to "work Time" at 7:00AM If I am home and if it's a weekday.
Part 2 - Office Scenes when mode changes turn on/ off devices, mute/unmute computer and turn on/off computer monitors. This uses https://assistantcomputercontrol.com/ on a windows machine bypassing IFTT and dropbox by writing directly to a windows share.

discussed here Node-RED work and bed time flows

flow

[
{
"id": "16c8a7d5.e07098",
"type": "tab",
"label": "Week Day Alarm",
"disabled": false,
"info": ""
},
{
"id": "1ed910a2.658ddf",
"type": "cronplus",
"z": "16c8a7d5.e07098",
"name": "weekday 7AM",
"outputField": "payload",
"timeZone": "America/New_York",
"persistDynamic": false,
"commandResponseMsgOutput": "output1",
"outputs": 1,
"options": [
{
"name": "7AM weekday",
"topic": "7AM weekday",
"payloadType": "str",
"payload": "",
"expressionType": "cron",
"expression": "0 7 * * 1-5 ",
"location": "",
"offset": "0",
"solarType": "all",
"solarEvents": "sunrise,sunset"
}
],
"x": 120,
"y": 280,
"wires": [
[
"9457d1a7.e9a53"
]
]
},
{
"id": "9457d1a7.e9a53",
"type": "hubitat device",
"z": "16c8a7d5.e07098",
"name": "Pat Richards’s iPhone XS max",
"server": "6b0c5f4f.a782d",
"deviceId": "8",
"attribute": "presence",
"sendEvent": true,
"x": 390,
"y": 280,
"wires": [
[
"eeecdf71.ac468"
]
],
"info": "If Pat's home"
},
{
"id": "eeecdf71.ac468",
"type": "switch",
"z": "16c8a7d5.e07098",
"name": "if present",
"property": "payload.currentValue",
"propertyType": "msg",
"rules": [
{
"t": "cont",
"v": "present",
"vt": "str"
}
],
"checkall": "false",
"repair": false,
"outputs": 1,
"x": 650,
"y": 280,
"wires": [
[
"a1dc5328.f6f7b"
]
]
},
{
"id": "a1dc5328.f6f7b",
"type": "hubitat mode-setter",
"z": "16c8a7d5.e07098",
"name": "Set WorkTime",
"server": "6b0c5f4f.a782d",
"modeId": "5",
"x": 860,
"y": 280,
"wires": [
[]
]
},
{
"id": "fb8a7795.755618",
"type": "hubitat mode",
"z": "16c8a7d5.e07098",
"name": "",
"server": "6b0c5f4f.a782d",
"sendEvent": true,
"x": 80,
"y": 440,
"wires": [
[
"3c2864af.26696c"
]
]
},
{
"id": "3c2864af.26696c",
"type": "switch",
"z": "16c8a7d5.e07098",
"name": "",
"property": "payload.value",
"propertyType": "msg",
"rules": [
{
"t": "eq",
"v": "Work Time",
"vt": "str"
},
{
"t": "eq",
"v": "Bed time",
"vt": "str"
}
],
"checkall": "true",
"repair": false,
"outputs": 2,
"x": 210,
"y": 440,
"wires": [
[
"2ac28f0b.a1b1b"
],
[
"172b1b3a.ba57b5"
]
]
},
{
"id": "2ac28f0b.a1b1b",
"type": "hubitat command",
"z": "16c8a7d5.e07098",
"name": "Activate Worktime Scene",
"server": "6b0c5f4f.a782d",
"deviceId": "17",
"command": "on",
"commandArgs": "",
"x": 410,
"y": 360,
"wires": [
[
"1ebd0a36.e33af6"
]
]
},
{
"id": "172b1b3a.ba57b5",
"type": "hubitat command",
"z": "16c8a7d5.e07098",
"name": "Actvate Bedtime Scene",
"server": "6b0c5f4f.a782d",
"deviceId": "18",
"command": "on",
"commandArgs": "",
"x": 410,
"y": 480,
"wires": [
[
"5109eb60.350d44"
]
]
},
{
"id": "88df61cd.48dd1",
"type": "file",
"z": "16c8a7d5.e07098",
"name": "Send command to ACC",
"filename": "/mnt/ACC/mute.txt",
"appendNewline": true,
"createDir": false,
"overwriteFile": "true",
"encoding": "none",
"x": 870,
"y": 360,
"wires": [
[
"1f0bffc.264b7"
]
]
},
{
"id": "1ebd0a36.e33af6",
"type": "change",
"z": "16c8a7d5.e07098",
"name": "unmute command",
"rules": [
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "mute:false",
"tot": "str"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 650,
"y": 360,
"wires": [
[
"88df61cd.48dd1"
]
]
},
{
"id": "5109eb60.350d44",
"type": "change",
"z": "16c8a7d5.e07098",
"name": "mute command",
"rules": [
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "mute:true",
"tot": "str"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 640,
"y": 480,
"wires": [
[
"9af79771.648408"
]
]
},
{
"id": "9af79771.648408",
"type": "file",
"z": "16c8a7d5.e07098",
"name": "Send command to ACC",
"filename": "/mnt/ACC/mute.txt",
"appendNewline": true,
"createDir": false,
"overwriteFile": "true",
"encoding": "none",
"x": 870,
"y": 480,
"wires": [
[
"9466b2ed.4dc53"
]
]
},
{
"id": "86b1c8ae.7f64b8",
"type": "file",
"z": "16c8a7d5.e07098",
"name": "Send command to ACC",
"filename": "/mnt/ACC/run.txt",
"appendNewline": true,
"createDir": false,
"overwriteFile": "true",
"encoding": "none",
"x": 870,
"y": 540,
"wires": [
[]
]
},
{
"id": "9466b2ed.4dc53",
"type": "change",
"z": "16c8a7d5.e07098",
"name": "Monitors off",
"rules": [
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "open:c:\scratch\screenoff 2.exe",
"tot": "str"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 630,
"y": 540,
"wires": [
[
"86b1c8ae.7f64b8"
]
]
},
{
"id": "1f0bffc.264b7",
"type": "change",
"z": "16c8a7d5.e07098",
"name": "Monitors on",
"rules": [
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "key_shortcut:SPACE",
"tot": "str"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 630,
"y": 420,
"wires": [
[
"463a73a0.22883c"
]
]
},
{
"id": "463a73a0.22883c",
"type": "file",
"z": "16c8a7d5.e07098",
"name": "Send command to ACC",
"filename": "/mnt/ACC/space.txt",
"appendNewline": true,
"createDir": false,
"overwriteFile": "true",
"encoding": "none",
"x": 870,
"y": 420,
"wires": [
[]
]
},
{
"id": "6b0c5f4f.a782d",
"type": "hubitat config",
"z": "",
"name": "",
"usetls": false,
"host": "192.168.1.74",
"port": "80",
"appId": "45",
"nodeRedServer": "http://192.168.1.74:1880",
"webhookPath": "/hubitat/webhook",
"autoRefresh": true,
"useWebsocket": true
}
]

3 Likes

Can you share the scripts you are using, if they are not 'sensative' (passwords)?

Like mute.txt, and run.txt

no scripts :slight_smile: its in the message payload generated in the change node that precede each send command to ACC

1 Like

Title: Periodic internet speed test

Summary:
This sequence keeps track of my internet speed (every hour) and plots the data out in NR dashboard. I'm posting it because it gives a simple example of how to save and retrieve data.

Summary

[{"id":"f11a13be.36e21","type":"simpletime","z":"641677fe.7efb8","name":"","x":410,"y":660,"wires":[["c48f441a.c64868","12bb40d7.cee35f"]]},{"id":"c48f441a.c64868","type":"template","z":"641677fe.7efb8","name":"time","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"{{mydate}} {{mytimes}}","output":"str","x":650,"y":620,"wires":[["ef753891.93342"]]},{"id":"12bb40d7.cee35f","type":"switch","z":"641677fe.7efb8","name":"down < 100","property":"payload.speeds.download","propertyType":"msg","rules":[{"t":"lt","v":"100","vt":"num"}],"checkall":"true","repair":false,"outputs":1,"x":670,"y":820,"wires":[["ff368af4.ae96d"]]},{"id":"9e3f58fe.e530e","type":"speedtest","z":"641677fe.7efb8","name":"Speedtest","serverId":"","maxTime":"120000","x":410,"y":600,"wires":[["aa623598.74eb98","b2a90ab2.32421","dbc3c3e7.20861","6755d730.02674","a012c307.cb4028","f11a13be.36e21"]]},{"id":"ef753891.93342","type":"ui_text","z":"641677fe.7efb8","group":"2a046f7e.21973","order":6,"width":0,"height":0,"name":"Last Speedtest","label":"Last Speedtest","format":"<font color=\"cyan\">{{msg.payload}}</font>","layout":"col-center","x":920,"y":620,"wires":[]},{"id":"ff368af4.ae96d","type":"change","z":"641677fe.7efb8","name":"Speed Test","rules":[{"t":"set","p":"topic","pt":"msg","to":"Speed Test","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":850,"y":820,"wires":[["aa219933.4c2e6"]]},{"id":"aa623598.74eb98","type":"change","z":"641677fe.7efb8","name":"download","rules":[{"t":"set","p":"topic","pt":"msg","to":"Download","tot":"str"},{"t":"set","p":"payload","pt":"msg","to":"payload.speeds.download","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":660,"y":540,"wires":[["b61f1f5e.41d8b8","288318fc.e25458"]]},{"id":"b2a90ab2.32421","type":"change","z":"641677fe.7efb8","name":"upload","rules":[{"t":"set","p":"topic","pt":"msg","to":"Upload","tot":"str"},{"t":"set","p":"payload","pt":"msg","to":"payload.speeds.upload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":660,"y":580,"wires":[["bd35f52c.df077","288318fc.e25458"]]},{"id":"dbc3c3e7.20861","type":"change","z":"641677fe.7efb8","name":"ping","rules":[{"t":"set","p":"topic","pt":"msg","to":"Ping","tot":"str"},{"t":"set","p":"payload","pt":"msg","to":"payload.server.ping","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":650,"y":660,"wires":[["8b605dac.f72bd","1ee5385b.d78bb"]]},{"id":"6755d730.02674","type":"change","z":"641677fe.7efb8","name":"distance","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.server.distanceMi","tot":"msg"},{"t":"set","p":"topic","pt":"msg","to":"Distance","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":660,"y":700,"wires":[["4402db66.176ac4","1ee5385b.d78bb"]]},{"id":"a012c307.cb4028","type":"change","z":"641677fe.7efb8","name":"ISP","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.server.sponsor","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":650,"y":740,"wires":[["ce98fa70.5faaa"]]},{"id":"9015ffc1.ef6a1","type":"ui_button","z":"641677fe.7efb8","name":"","group":"2a046f7e.21973","order":3,"width":0,"height":0,"label":"SpeedTest Now!","color":"","icon":"","payload":"","payloadType":"date","topic":"","x":190,"y":560,"wires":[["9e3f58fe.e530e"]]},{"id":"5493692d.1d584","type":"cronplus","z":"641677fe.7efb8","name":"5 minutes past the hour","outputField":"payload","timeZone":"","outputs":1,"options":[{"topic":"5 past every hour","payload":"start","type":"str","expression":"5 * * * *","name":"5 past every hour"}],"x":170,"y":640,"wires":[["9e3f58fe.e530e"]]},{"id":"aa219933.4c2e6","type":"template","z":"641677fe.7efb8","name":"SMS","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"Internet speed was {{payload.speeds.download}}/{{payload.speeds.upload}} (down/up Mbits/s) at {{mytimes}} on {{mymonthn}}/{{mydom}}. Speedtest server was {{payload.server.sponsor}}.","output":"str","x":1010,"y":820,"wires":[["5b712b3b.4d3b0c"]]},{"id":"b61f1f5e.41d8b8","type":"ui_gauge","z":"641677fe.7efb8","name":"","group":"2a046f7e.21973","order":7,"width":0,"height":0,"gtype":"gage","title":"Download Speed","label":"Download Mbits","format":"{{value}}","min":0,"max":"150","colors":["#ff002d","#e4b400","#03f81f"],"seg1":"50","seg2":"100","x":930,"y":540,"wires":[]},{"id":"288318fc.e25458","type":"ui_chart","z":"641677fe.7efb8","name":"Performance Chart","group":"6dbda234.52c8cc","order":2,"width":12,"height":6,"label":"Performance Chart","chartType":"line","legend":"true","xformat":"HH:mm:ss","interpolate":"linear","nodata":"","dot":false,"ymin":"","ymax":"","removeOlder":"2","removeOlderPoints":"","removeOlderUnit":"86400","cutout":"","useOneColor":false,"useUTC":false,"colors":["#1f77b4","#aec7e8","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"outputs":1,"x":930,"y":340,"wires":[["4860da2.4f503a4"]]},{"id":"bd35f52c.df077","type":"ui_gauge","z":"641677fe.7efb8","name":"","group":"2a046f7e.21973","order":8,"width":0,"height":0,"gtype":"gage","title":"Upload Speed","label":"Upload MBits","format":"{{value}}","min":0,"max":"15","colors":["#ff002d","#ffed36","#03f81f"],"seg1":"2","seg2":"8","x":920,"y":580,"wires":[]},{"id":"8b605dac.f72bd","type":"ui_text","z":"641677fe.7efb8","group":"2a046f7e.21973","order":4,"width":0,"height":0,"name":"","label":"Ping Time","format":"<font color=\"cyan\">{{msg.payload}}</font>","layout":"col-center","x":910,"y":660,"wires":[]},{"id":"1ee5385b.d78bb","type":"ui_chart","z":"641677fe.7efb8","name":"Latency Chart","group":"6dbda234.52c8cc","order":4,"width":12,"height":6,"label":"Latency Chart","chartType":"line","legend":"true","xformat":"HH:mm:ss","interpolate":"linear","nodata":"","dot":false,"ymin":"","ymax":"","removeOlder":"2","removeOlderPoints":"","removeOlderUnit":"86400","cutout":"","useOneColor":false,"useUTC":false,"colors":["#1f77b4","#aec7e8","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"outputs":1,"x":920,"y":460,"wires":[["84fc2070.d9275"]]},{"id":"4402db66.176ac4","type":"ui_text","z":"641677fe.7efb8","group":"2a046f7e.21973","order":5,"width":0,"height":0,"name":"","label":"Distance","format":"<font color=\"cyan\">{{msg.payload}} mi</font>","layout":"col-center","x":900,"y":700,"wires":[]},{"id":"ce98fa70.5faaa","type":"ui_text","z":"641677fe.7efb8","group":"2a046f7e.21973","order":2,"width":0,"height":0,"name":"","label":"Hosted By","format":"<font color=\"cyan\">{{msg.payload}}</font>","layout":"col-center","x":910,"y":740,"wires":[]},{"id":"5b712b3b.4d3b0c","type":"e-mail","z":"641677fe.7efb8","server":"localhost","port":"25","secure":false,"tls":false,"name":"5042727138@msg.fi.google.com","dname":"SMS Notification","x":1190,"y":820,"wires":[]},{"id":"4860da2.4f503a4","type":"file","z":"641677fe.7efb8","name":"Speed Test Data Save","filename":"/home/odroid/.node-red/data/speedtest/speedtestData.json","appendNewline":false,"createDir":false,"overwriteFile":"true","encoding":"none","x":1180,"y":340,"wires":[[]]},{"id":"976aad37.93366","type":"json","z":"641677fe.7efb8","name":"","x":1150,"y":280,"wires":[["288318fc.e25458"]]},{"id":"84fc2070.d9275","type":"file","z":"641677fe.7efb8","name":"Speed Test Data Save","filename":"/home/odroid/.node-red/data/speedtest/speedtestDataPD.json","appendNewline":false,"createDir":false,"overwriteFile":"true","x":1180,"y":420,"wires":[[]]},{"id":"1b6007eb.95fd98","type":"json","z":"641677fe.7efb8","name":"","x":1150,"y":520,"wires":[["1ee5385b.d78bb"]]},{"id":"559e7829.3d7fb","type":"file in","z":"641677fe.7efb8","name":"Speed Test Data Restore","filename":"/home/odroid/.node-red/data/speedtest/speedtestData.json","format":"utf8","x":1190,"y":380,"wires":[["976aad37.93366"]]},{"id":"1d72d587.de0bd2","type":"file in","z":"641677fe.7efb8","name":"Speed Test Data Restore","filename":"/home/odroid/.node-red/data/speedtest/speedtestDataPD.json","format":"utf8","x":1190,"y":460,"wires":[["1b6007eb.95fd98"]]},{"id":"e65149c6.542d","type":"inject","z":"641677fe.7efb8","name":"","repeat":"","crontab":"","once":true,"topic":"","payload":"restore","payloadType":"str","x":920,"y":400,"wires":[["559e7829.3d7fb","1d72d587.de0bd2"]]},{"id":"2a046f7e.21973","type":"ui_group","z":"","name":"Graphs","tab":"929d3236.90d2","order":1,"disp":false,"width":"6","collapse":false},{"id":"6dbda234.52c8cc","type":"ui_group","z":"","name":"Charts","tab":"929d3236.90d2","order":2,"disp":false,"width":"12","collapse":false},{"id":"929d3236.90d2","type":"ui_tab","z":"","name":"Internet Speed","icon":"dashboard","order":1,"disabled":false,"hidden":false}]

13 Likes

Title - Backup Node Red

Summary
This flow is one I found, I'm not sure where though so unable to credit the person who created it. But thought it useful after I trashed my Node Red recently, due to an oversight on my part (oops).

This requires a piece of software installing on your PI called Resilio.
Instructions can be found here. You can also install on Windows too on their main website here.

To configure, browse to you PI IP and port 8888, you can then set up the pairing, and share the key to yourself, for another machine to access your backups.

The flow

You can modify the paths accordingly in the nodes "backup .node-red" and "delete older than 7 days" (and the number of days to keep). I added Pushover and receive a nice message when complete. Which I use as a reminder to copy the backup back.

The Flow

[{"id":"cad1c731.992228","type":"tab","label":"Pi-Backup","disabled":false,"info":"Rotating backup of .node-red folder"},{"id":"9f50db03.848e48","type":"exec","z":"cad1c731.992228","command":"sudo zip -rq /home/royski/sync/Backups/node-red-pi4-backup-$(date +%Y-%m-%d).zip /home/royski/.node-red","addpay":false,"append":"","useSpawn":"false","timer":"","oldrc":false,"name":"backup .node-red","x":410,"y":40,"wires":[["ef8d10db.d8e83"],["ef8d10db.d8e83"],["1bd3ae23.6e9f22"]]},{"id":"a7b79704.1505c8","type":"inject","z":"cad1c731.992228","name":"daily @2200","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"00 22 * * ","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":180,"y":40,"wires":[["9f50db03.848e48"]]},{"id":"ad21052b.df89d8","type":"debug","z":"cad1c731.992228","name":"backup-log","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":990,"y":120,"wires":[]},{"id":"1bd3ae23.6e9f22","type":"switch","z":"cad1c731.992228","name":"check op success","property":"payload.code","propertyType":"msg","rules":[{"t":"eq","v":"0","vt":"num"},{"t":"else"}],"checkall":"true","repair":false,"outputs":2,"x":230,"y":180,"wires":[["b329b40c.035f38"],["45de1bdb.02cd24"]]},{"id":"b329b40c.035f38","type":"exec","z":"cad1c731.992228","command":"sudo find /home/royski/sync/Backups/.zip -mtime +7 -type f -delete","addpay":false,"append":"","useSpawn":"false","timer":"","oldrc":false,"name":"delete older than 7 days","x":470,"y":140,"wires":[["ef8d10db.d8e83"],["ef8d10db.d8e83"],["954f68c7.dc2988"]]},{"id":"45de1bdb.02cd24","type":"change","z":"cad1c731.992228","name":"custom error msg","rules":[{"t":"set","p":"payload","pt":"msg","to":":red_circle: There was an error in Pi4 backup flow. Check logs.","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":570,"y":260,"wires":[["ad21052b.df89d8","a45d5a55.614c48"]]},{"id":"954f68c7.dc2988","type":"switch","z":"cad1c731.992228","name":"check op success","property":"payload.code","propertyType":"msg","rules":[{"t":"eq","v":"0","vt":"num"},{"t":"else"}],"checkall":"true","repair":false,"outputs":2,"x":490,"y":200,"wires":[["17260390.570bec"],["45de1bdb.02cd24"]]},{"id":"17260390.570bec","type":"template","z":"cad1c731.992228","name":"success msg","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":":white_check_mark: RPi4 Backup compelete.","output":"str","x":750,"y":120,"wires":[["ad21052b.df89d8","a45d5a55.614c48"]]},{"id":"ef8d10db.d8e83","type":"switch","z":"cad1c731.992228","name":"filter null","property":"payload","propertyType":"msg","rules":[{"t":"nnull"},{"t":"else"}],"checkall":"true","repair":false,"outputs":2,"x":660,"y":40,"wires":[["ad21052b.df89d8"],[]]},{"id":"a45d5a55.614c48","type":"pushover api","z":"cad1c731.992228","keys":"54ad51a1.76db6","title":"","name":"","x":960,"y":260,"wires":[]},{"id":"54ad51a1.76db6","type":"pushover-keys","z":"","name":"Pushover"}]

The backup is scheduled, but can be changed in the first node, and executes here at 22:00 every day.

4 Likes

27 posts were split to a new topic: What platforms are folks running Node-Red on?

Title: Setting the mode when the maid arrives and leaves

Summary:
My maid doesn't like to work when I'm at home. But I want the house to be comfortable etc. when she comes here. So I set the mode to Home mode when she uses her key code (also get notified by SMS that she has arrived). I also set a global variable called "maid switch" to be on when she arrives. Similarly, when she leaves, I set the mode to be Away (if I am also away), and set "maid switch" to be off. The maid switch global variable is used to prevent motion lighting sequences from running while she's here.

Summary

[{"id":"3c08dd61.fb19fa","type":"comment","z":"bb5edffe.27e038","name":"Maid's lock code turns on Home mode (via MQTT) and Maid global variable (via MQTT). Also sends me an SMS.","info":"","x":430,"y":620,"wires":[]},{"id":"99473dd5.c0c138","type":"hubitat device","z":"bb5edffe.27e038","name":"Front Door Lock","server":"a22e0ea9.276dc8","deviceId":"1219","attribute":"lastCodeName","sendEvent":true,"x":140,"y":737,"wires":[["d792b281.1c7338"]]},{"id":"d792b281.1c7338","type":"switch","z":"bb5edffe.27e038","name":"Maid's code","property":"payload.value","propertyType":"msg","rules":[{"t":"eq","v":"Pattie Poehl","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":330,"y":737,"wires":[["f06444a.681b6b8","363507d.56160f8","dde624a.c8cd958"]]},{"id":"a620554b.47e9f8","type":"switch","z":"bb5edffe.27e038","name":"off","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"off","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":310,"y":1140,"wires":[["cb00eedc.83c16"]]},{"id":"cb00eedc.83c16","type":"hubitat device","z":"bb5edffe.27e038","name":"Ashok's Combined Presence","server":"662851c4.3ccad","deviceId":"2475","attribute":"presence","sendEvent":false,"x":520,"y":1140,"wires":[["e5351536.64c718"]]},{"id":"e5351536.64c718","type":"switch","z":"bb5edffe.27e038","name":"not present","property":"payload.value","propertyType":"msg","rules":[{"t":"eq","v":"not present","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":750,"y":1140,"wires":[["fbfb3ea5.4b1b1"]]},{"id":"7ee04fa.91fc2b","type":"switch","z":"bb5edffe.27e038","name":"button","property":"payload.descriptionText","propertyType":"msg","rules":[{"t":"cont","v":"button","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":990,"y":940,"wires":[["ab84a1a0.3506f8","f6c63738.bfcb98"]]},{"id":"83125a3a.360738","type":"switch","z":"bb5edffe.27e038","name":"locked","property":"payload.value","propertyType":"msg","rules":[{"t":"eq","v":"locked","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":850,"y":940,"wires":[["7ee04fa.91fc2b"]]},{"id":"ab84a1a0.3506f8","type":"change","z":"bb5edffe.27e038","name":"topic","rules":[{"t":"set","p":"topic","pt":"msg","to":"Pattie Poehl status","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":790,"y":1000,"wires":[["3f430222.6cf72e"]]},{"id":"3f430222.6cf72e","type":"simpletime","z":"bb5edffe.27e038","name":"","x":950,"y":1000,"wires":[["641deb38.d130f4"]]},{"id":"c72e4492.76603","type":"switch","z":"bb5edffe.27e038","name":"maid_status = on","property":"pp_status","propertyType":"global","rules":[{"t":"eq","v":"on","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":670,"y":940,"wires":[["83125a3a.360738"]]},{"id":"641deb38.d130f4","type":"template","z":"bb5edffe.27e038","name":"SMS","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"Pattie Poehl left at {{mytimes}} on {{mymonthn}}/{{mydom}}.","output":"str","x":1110,"y":1000,"wires":[["9701371.e9c0d48"]]},{"id":"9701371.e9c0d48","type":"link out","z":"bb5edffe.27e038","name":"SMS-out","links":["67fd4532.52d0e4"],"x":1215,"y":1000,"wires":[]},{"id":"6163fdea.92a344","type":"hubitat device","z":"bb5edffe.27e038","name":"Front Door Lock","server":"a22e0ea9.276dc8","deviceId":"1219","attribute":"","sendEvent":true,"x":140,"y":940,"wires":[["8e53d7d.2c9d6a8"]]},{"id":"8e53d7d.2c9d6a8","type":"time-range-switch","z":"bb5edffe.27e038","name":"11:00-15:00","lat":"29.977091","lon":"-90.143000","startTime":"11:00","endTime":"15:00","startOffset":0,"endOffset":0,"x":330,"y":940,"wires":[["932e2a41.490068"],[]]},{"id":"932e2a41.490068","type":"weekday","z":"bb5edffe.27e038","name":"M-F","sun":false,"mon":true,"tue":true,"wed":true,"thu":true,"fri":true,"sat":false,"x":490,"y":940,"wires":[["c72e4492.76603"],[]]},{"id":"9d464d55.a36148","type":"comment","z":"bb5edffe.27e038","name":"Front door locked using button on the outside on M-F (11am-3pm) if the Maid global variable was on, sets the variable to off (via MQTT) and sends me a text","info":"","x":570,"y":880,"wires":[]},{"id":"41a4c581.08a0f4","type":"comment","z":"bb5edffe.27e038","name":"Maid global variable being set to off when I am away will turn on Away mode","info":"","x":310,"y":1080,"wires":[]},{"id":"f06444a.681b6b8","type":"change","z":"bb5edffe.27e038","name":"topic","rules":[{"t":"set","p":"topic","pt":"msg","to":"Pattie Poehl status","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":490,"y":737,"wires":[["9943c928.172678"]]},{"id":"9943c928.172678","type":"simpletime","z":"bb5edffe.27e038","name":"","x":650,"y":737,"wires":[["74c72516.e2fb2c"]]},{"id":"74c72516.e2fb2c","type":"template","z":"bb5edffe.27e038","name":"SMS","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"Pattie Poehl arived at {{mytimes}} on {{mymonthn}}/{{mydom}}.","output":"str","x":810,"y":737,"wires":[["eaf3c2c4.54562"]]},{"id":"eaf3c2c4.54562","type":"link out","z":"bb5edffe.27e038","name":"SMS-out","links":["67fd4532.52d0e4"],"x":915,"y":737,"wires":[]},{"id":"b8bba3d5.32c01","type":"switch","z":"bb5edffe.27e038","name":"maid_status = off","property":"pp_status","propertyType":"global","rules":[{"t":"eq","v":"off","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":1090,"y":1140,"wires":[["301416e1.17ef2a"]]},{"id":"fbfb3ea5.4b1b1","type":"delay","z":"bb5edffe.27e038","name":"5m","pauseType":"delay","timeout":"5","timeoutUnits":"minutes","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":910,"y":1140,"wires":[["b8bba3d5.32c01"]]},{"id":"363507d.56160f8","type":"change","z":"bb5edffe.27e038","name":"home","rules":[{"t":"set","p":"payload","pt":"msg","to":"home","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":490,"y":685,"wires":[["5b10d719.8cc428"]]},{"id":"5b10d719.8cc428","type":"mqtt out","z":"bb5edffe.27e038","name":"mode","topic":"mode","qos":"2","retain":"false","broker":"40144fb8.a1c1e","x":630,"y":685,"wires":[]},{"id":"301416e1.17ef2a","type":"change","z":"bb5edffe.27e038","name":"away","rules":[{"t":"set","p":"payload","pt":"msg","to":"away","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1270,"y":1140,"wires":[["539b816e.69def"]]},{"id":"539b816e.69def","type":"mqtt out","z":"bb5edffe.27e038","name":"mode","topic":"mode","qos":"2","retain":"false","broker":"40144fb8.a1c1e","x":1410,"y":1140,"wires":[]},{"id":"16193ab2.624a7d","type":"mqtt out","z":"bb5edffe.27e038","name":"maid","topic":"switch/maid","qos":"2","retain":"false","broker":"40144fb8.a1c1e","x":1270,"y":940,"wires":[]},{"id":"94f91fc7.32cef8","type":"mqtt out","z":"bb5edffe.27e038","name":"maid","topic":"switch/maid","qos":"2","retain":"false","broker":"40144fb8.a1c1e","x":630,"y":785,"wires":[]},{"id":"8f338150.94dbe8","type":"mqtt in","z":"bb5edffe.27e038","name":"maid","topic":"switch/maid","qos":"2","datatype":"auto","broker":"40144fb8.a1c1e","x":170,"y":1140,"wires":[["a620554b.47e9f8"]]},{"id":"f6c63738.bfcb98","type":"change","z":"bb5edffe.27e038","name":"off","rules":[{"t":"set","p":"payload","pt":"msg","to":"off","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1130,"y":940,"wires":[["16193ab2.624a7d"]]},{"id":"dde624a.c8cd958","type":"change","z":"bb5edffe.27e038","name":"on","rules":[{"t":"set","p":"payload","pt":"msg","to":"on","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":490,"y":785,"wires":[["94f91fc7.32cef8"]]},{"id":"a22e0ea9.276dc8","type":"hubitat config","z":"","name":"HubitatM","usetls":false,"host":"192.168.1.46","port":"80","appId":"1522","nodeRedServer":"http://192.168.1.4:1880","webhookPath":"/hubitat/webhook","autoRefresh":true,"useWebsocket":false},{"id":"662851c4.3ccad","type":"hubitat config","z":"","name":"HubitatS","usetls":false,"host":"192.168.1.36","port":"80","appId":"4489","nodeRedServer":"http://192.168.1.4:1880","webhookPath":"/hubitat/webhook2","autoRefresh":true,"useWebsocket":false},{"id":"40144fb8.a1c1e","type":"mqtt-broker","z":"","name":"","broker":"127.0.0.1","port":"1883","tls":"","clientid":"","usetls":false,"compatmode":false,"keepalive":"15","cleansession":true,"birthTopic":"","birthQos":"0","birthRetain":"false","birthPayload":"","closeTopic":"","closeRetain":"false","closePayload":"","willTopic":"","willQos":"0","willRetain":"false","willPayload":""}]

4 Likes

@aaiyar ok I tried copy and pasting the net monitoring flow and am getting an unexpected token at 2060 font color="cyan">{{msg.

any ideas

1 Like

Yep me too.

It's the first one you post, internet speed test

Waiting in line - will fix it when I’m back home. Basically, its a linkout to an email node that sends me an SMS.

1 Like

Title - All Lux events on 1 trigger

Summary - very basic, but posting as an idea that you can have all your lux based events on one lux trigger rather than using many. This could help minimize processing time, and allow all flows to operate smoother (in theory). For me it also helps troubleshooting. Also using Groups and colors to know which is an On/Off group

Flow

[{"id":"892e3f54.4c9e3","type":"group","z":"3e9ba05f.df3bc","name":"","style":{"stroke":"#999999","fill":"#bfdbef","fill-opacity":"0.47","label":true,"label-position":"nw","color":"#a4a4a4"},"nodes":["95c0fdb.5b485","c08812cf.47394","dc7da0cf.7122c","e969ed8e.eac46","3df09ee1.4898d2","6f089d3c.c1f6f4","533b7de2.542fb4","2abcab9c.915934","29def96f.4d8636","d5aca7ad.c83d18","2628c75e.a7bd18","2aee9a01.736f96"],"x":34,"y":139,"w":1572,"h":222},{"id":"95c0fdb.5b485","type":"switch","z":"3e9ba05f.df3bc","g":"892e3f54.4c9e3","name":"+/- 1 Lux","property":"payload.value","propertyType":"msg","rules":[{"t":"gt","v":"1","vt":"str"},{"t":"lt","v":"1","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":440,"y":320,"wires":[["c08812cf.47394"],[]]},{"id":"c08812cf.47394","type":"hubitat command","z":"3e9ba05f.df3bc","g":"892e3f54.4c9e3","name":"Mnt Multch Light Off","server":"e40ec0b5.83be","deviceId":"526","command":"off","commandArgs":"","x":640,"y":320,"wires":[[]]},{"id":"dc7da0cf.7122c","type":"switch","z":"3e9ba05f.df3bc","g":"892e3f54.4c9e3","name":"On?","property":"payload.value","propertyType":"msg","rules":[{"t":"eq","v":"on","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":710,"y":220,"wires":[["533b7de2.542fb4"]]},{"id":"e969ed8e.eac46","type":"switch","z":"3e9ba05f.df3bc","g":"892e3f54.4c9e3","name":"+/- 100","property":"payload.value","propertyType":"msg","rules":[{"t":"lt","v":"100","vt":"str"},{"t":"gt","v":"100","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":1080,"y":220,"wires":[["d5aca7ad.c83d18"],[]]},{"id":"3df09ee1.4898d2","type":"hubitat command","z":"3e9ba05f.df3bc","g":"892e3f54.4c9e3","name":"Family Room - Bias Lighting On","server":"e40ec0b5.83be","deviceId":"2631","command":"on","commandArgs":"","x":1450,"y":220,"wires":[[]]},{"id":"6f089d3c.c1f6f4","type":"hubitat device","z":"3e9ba05f.df3bc","g":"892e3f54.4c9e3","name":"Living Room - -Harmoney Hub","server":"cd3ac91b.fa39d8","deviceId":"257","attribute":"switch","sendEvent":false,"x":510,"y":220,"wires":[["dc7da0cf.7122c"]]},{"id":"533b7de2.542fb4","type":"hubitat device","z":"3e9ba05f.df3bc","g":"892e3f54.4c9e3","name":"Front Porch Lux","server":"e40ec0b5.83be","deviceId":"455","attribute":"illuminance","sendEvent":false,"x":860,"y":220,"wires":[["2abcab9c.915934"]]},{"id":"2abcab9c.915934","type":"rbe","z":"3e9ba05f.df3bc","g":"892e3f54.4c9e3","name":"","func":"rbe","gap":"","start":"","inout":"out","property":"payload","x":975,"y":220,"wires":[["e969ed8e.eac46"]],"l":false},{"id":"29def96f.4d8636","type":"hubitat device","z":"3e9ba05f.df3bc","g":"892e3f54.4c9e3","name":"Front Porch Lux","server":"e40ec0b5.83be","deviceId":"455","attribute":"illuminance","sendEvent":true,"x":140,"y":320,"wires":[["6f089d3c.c1f6f4","95c0fdb.5b485"]]},{"id":"d5aca7ad.c83d18","type":"hubitat command","z":"3e9ba05f.df3bc","g":"892e3f54.4c9e3","name":"Set to 25%","server":"e40ec0b5.83be","deviceId":"2631","command":"setLevel","commandArgs":"25","x":1230,"y":220,"wires":[["3df09ee1.4898d2"]]},{"id":"2628c75e.a7bd18","type":"comment","z":"3e9ba05f.df3bc","g":"892e3f54.4c9e3","name":"TV Bias Lighting ON at dark if TV was on before dark","info":"","x":570,"y":180,"wires":[]},{"id":"2aee9a01.736f96","type":"comment","z":"3e9ba05f.df3bc","g":"892e3f54.4c9e3","name":"Mount Multh Off when day light","info":"","x":510,"y":280,"wires":[]},{"id":"e40ec0b5.83be","type":"hubitat config","z":"","name":"Devices Hub","usetls":false,"host":"10.13.9.11","port":"80","appId":"2532","nodeRedServer":"http://10.13.9.15:1880","webhookPath":"/hubitat/webhook","autoRefresh":true,"useWebsocket":false},{"id":"cd3ac91b.fa39d8","type":"hubitat config","z":"","name":"Apps Hub","usetls":false,"host":"10.13.9.12","port":"80","appId":"899","nodeRedServer":"http://10.13.9.15:1880","webhookPath":"/hubitat/webhook___","autoRefresh":true,"useWebsocket":false}]

1 Like

A lot of things to learn here thank you everyone.

1 Like

@TechMedX @pat.richards

Sorry for the delay. Gone over to spend Friday night with my godson and his parents. With a dozen Krispy Kreme donuts (think I'm lying - ask @april.brandt - I sent her video skyped her while waiting in line for one whole hour!).

Here's the part that's missing from both the sequences that I posted above:

Summary

[{"id":"78b9084e.935e2","type":"e-mail","z":"6badeeaa.cb9518","server":"localhost","port":"25","secure":false,"tls":false,"name":"5042727138@msg.fi.google.com","dname":"SMS Notification","x":750,"y":1160,"wires":[]},{"id":"67fd4532.52d0e4","type":"link in","z":"6badeeaa.cb9518","name":"SMS-in","links":["2e3271f3.42e9be","422e0d17.3032a4","c932aab.1bb8fd8","aa45f9ea.b2fbc8","cf9097fd.a158a8","3c8c9fab.8e114","7d540651.415d88","da5eea2.6ba5098","ebcf3eae.d42478","6eb7b011.78713","4683f5e2.ab0b74","e0970025.c70f18","a2d34170.2cc12","4f40776b.8fd0c","f48f9ffb.182e1","49bcf55e.f16744","14d97c87.6e95d3","68859b84.6b280c","20caca0d.100d9e","fc5950de.b235","35481e59.802562","a6bbfea4.4396a","b118f2ac.a6e25","2999bfe8.73de68","ca807e0e.c358d8","c5881a95.4c5ae","ad8be50f.a61a1","99c8f064.7e33c8","d1a330e.c2a2ed","84508d27.afb278","3e51173d.baa278","9588f2c7.86342","87d8486d.b3309","544741ea.cd94d8","3d9b6fca.7fac2","bdd18ede.d5c6a8","33976a29.61f596","ac249be8.1d6868","c46003d7.5cfc38","9701371.e9c0d48","5e636255.6b5b6c","c4e379a5.8244a8","eaf3c2c4.54562","cdc220c7.3ee598","107fe150.d2e157","ab5560ba.d61b98","d49d9e27.4c2008","f6482c7.ad570d","a18e470f.6f8bf","3f3ae1aa.ff4246","c34e3c47.50b0d8","c55cbcac.76832","be415b8c.8405f","532d3ae9.823684","2dd0e288.9f4876","11a88d1d.b7c843","45682217.091ddc","b236688d.49048","22c0ccbf.2bc3fc","6319926a.216ddc","dd7ef8b5.bb007","fb96c6c2.75906","ce9eb216.30e02","f446c605.1feee"],"x":575,"y":1160,"wires":[["78b9084e.935e2"]]}]

2 Likes

I can attest to that as long as you don't tattle on me for skype-n-driving. My husband tells me that it's their anniversary today and that you can get TWO DOZEN for the price of one. @aaiyar you're holding out?

2 Likes

Hour seriously? Guess I take Krispy Kreme for granted growing up near where they got started. Was interesting to watch when I lived in CA as they were opening stores and people would be carrying 2 dozen in the airport as if they were precious goods.

2 Likes

I did get two dozen. I gave one dozen to my godson's parents (mom is expecting his younger brother). I gave half-a-dozen to a medical resident that lives down the street. Not sure what happened to the last half-dozen. Couldn't be me - I'm diabetic.

3 Likes

There's a famous outlet in Japan next to our office there where I was told people used to queue down the street every day when it first opened. This practice continued for several years apparently, it was so so popular. Love 'em but they're not good for my diet (which is not really a diet at all, it's more just wishful thinking really) :rofl:

3 Likes

Donuts, too.

3 Likes

Bad donuts are hardware. KKs are definitely software.

3 Likes

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