Node-Red Flow Samples/Sharing

.
Fun little flow I put together tonight to pull data from the Trakt.TV API


.

I use the first row of nodes to send a telegram message to myself that has the link and the device code

Once the code is entered there, Node-RED will pull the generated token and that is good for 3 months from that point. So obviously I am using the persistent storage option for my flow variables to store that to survive reboots. Setting that up is the only thing special needed.

I was thinking of storing the date the token was generated and checking that once a day and if it's close to expiring shoot off that message to Telegram to renew the token.
.

An example of what to do with the data retrieved.

2 Likes

How I check for battery sensors still being alive:


I have separate flows for each type.

Code

[{"id":"ff5ad7f6.3f46a8","type":"pushover api","z":"f1e3446e.38da88","keys":"2a52b42c.7e9f0c","title":"","name":"Push: No Response","x":1060,"y":480,"wires":[]},{"id":"d087ae9.ce4895","type":"string","z":"f1e3446e.38da88","name":"","methods":[{"name":"append","params":[{"type":"str","value":" has not responded in 24 Hours!"}]}],"prop":"topic","propout":"payload","object":"msg","objectout":"msg","x":890,"y":480,"wires":[["ff5ad7f6.3f46a8"]]},{"id":"11491c90.a694f3","type":"stoptimer-varidelay","z":"f1e3446e.38da88","duration":"24","durationType":"num","units":"Hour","payloadtype":"num","payloadval":"0","name":"","reporting":"last_minute_seconds","x":520,"y":100,"wires":[["d087ae9.ce4895","928ab9ea.00d278"],[],[]]},{"id":"928ab9ea.00d278","type":"hubitat device","z":"f1e3446e.38da88","name":"Becca Room: Window","server":"f17566a9.c052b8","deviceId":"2554","attribute":"","sendEvent":true,"x":200,"y":100,"wires":[["11491c90.a694f3"]]},{"id":"2a52b42c.7e9f0c","type":"pushover-keys","name":""},{"id":"f17566a9.c052b8","type":"hubitat config","name":"","usetls":false,"host":"192.168.1.50","port":"80","appId":"3424","nodeRedServer":"http://192.168.1.50:1880","webhookPath":"/hubitat/webhook","autoRefresh":true,"useWebsocket":false}]

4 Likes

If you use it, have you ever considered pulling the data from Sonarr instead? Trakt has been having significant performance issues lately and they're making all kinds of changes to their API. I find 1 of 3 times I try to hit trakt.tv lately the site is down. Sonarr would keep things local.

I had never heard of that site before.

I've been using Trakt for years, even subscribed to it, I'll keep using either their RSS feed or API until I have issues with it (which has been zero to this point)

TheTVDB is another super popular site that seems to be crumbling under traffic, as it's now $12 a year to use their API, that for sure used to be free up until recently.

Sonarr isn't really a site. It's an application used for automating downloads/naming/moving/sorting/etc of tv series. It pulls its data from TVDB. There's also Radarr for movies and Lidarr for music. All are commonly used by cord cutters and have local api's since their applications run within your system.

I use trakt to keep watched status in sync between 2 Emby servers and a Plex server. But with the issues with their site, I've been using Simkl.com for this the past few months.

Okay so this is a stab at trying to get generic pseudo HE grouping in NR... wanted to put this out there in case someone was interested. This will work across multiple hubs/maker instances but for now some "hard-coding" (manual node-editing) is required.

nr221

Basic installation..

  • import subflows.
  • delete erroneous HE hub configs.
  • You will have to manually edit the HubGrpCommand, HubGrpEvents, HubGrpRequest nodes.
    • Come up with a "hub id" for each hub. Can be any alphanum string at this point. deviceIds take the form [hubId]/[deviceId] and are separated by commas.
    • Edit the HubGroup subflows and modify the existing nodes with your hub config and "hub id"' info.

Usage Notes:

  • The basic idea is to set the deviceId property with all the HE node deviceIds you want to group separated by commas and in the form hubId/deviceId1,hubId/deviceId2... etc. Then use DevGrpEvent and DevGrpCommand subflow nodes like you would with the HE Device and Command Nodes.
  • There are lots of properties of the nodes you can play around with.. specifically the "ACTION" properties - you can group "switches" (default) together or "contact sensors" etc - just have to define:
    • TOPIC - The "name" of the group used in various messages etc.
    • TYPE - "switch","contact" etc
    • ACTIONS - "on/off","open/closed" etc
    • When the event should fire using TYPE = "switch" / ACTIONS = "on/off" as an example
      • ALL_Action1 refers to the "on" in "on/off" in the ACTIONS property while ALL_Action2 refers to the "off" part.
      • Setting ALL_Action1 to true fires "on" events when all devices are "on"
      • Setting ALL_Action2 to true fires "off" events when all devices are "off"
      • If both ALL_Action1 & ALL_Action2 are set to true then when some switches are turned on or off the state is considered "pending" and no events will fire.
      • Setting both ALL_Action1 and ALL_Action2 to false is "undefined" because any switch "on" or "off" would never trigger an action.
    • SEND_ALL_EVENTS generates messages based on incoming events from the defined group.
    • RETURN_ALL_MSGS returns the payload.value of the triggered individual device instead of the accumulated group. Good for door open alerts etc (when one or more door is open).

WARNING!!!

  • This is still a work in progress so expect many bugs/headaches etc - use at your own risk.
  • There are probably a 1000 much easier ways to do this.. but I am sadly prone to greatly over-engineering things.
  • I haven't tested non "switch" TYPE groupings.. but as long as the responses are binary in nature (on/off, open/closed, active/inactive) they should work.
  • The "groups" are simple predefined aggregations of the same type of device. No mixing of devices allowed.
  • Importing the following subflows will add a bunch of HE hub configs you will have to remove.
  • There are no instructions on node usage yet so kind of have to wing it for now.

Here ya go:

Groupings in NR - this is the original posting

[{"id":"4e1e6fde.a5bbf","type":"subflow","name":"HubGrpCommand","info":"","category":"","in":[{"x":40,"y":40,"wires":[{"id":"b47983a7.7b5f7"}]}],"out":[{"x":1220,"y":180,"wires":[{"id":"7c32f9e4.9fd4f8","port":0},{"id":"e076de00.f88b6","port":0},{"id":"320acf5d.6b427","port":0},{"id":"ef3ddba.1057c28","port":0},{"id":"b706dd3b.cf87a","port":0},{"id":"47e952f6.d8d37c","port":0}]}],"env":[],"color":"#DDAA99"},{"id":"fb597717.109328","type":"hubitat command","z":"4e1e6fde.a5bbf","name":"Control Hub / CTRL","server":"bc9b2ba4.2458c8","deviceId":"","command":"","commandArgs":"","x":510,"y":60,"wires":[["7c32f9e4.9fd4f8"]]},{"id":"2a44d5ee.875b7a","type":"hubitat command","z":"4e1e6fde.a5bbf","name":"Main Hub / OMNF","server":"5664ca29.3af904","deviceId":"","command":"","commandArgs":"","x":510,"y":120,"wires":[["e076de00.f88b6"]]},{"id":"448a391d.a21278","type":"hubitat command","z":"4e1e6fde.a5bbf","name":"Main Hub - Zigbee / OZIG","server":"623daead.b1d2b","deviceId":"","command":"","commandArgs":"","x":530,"y":180,"wires":[["320acf5d.6b427"]]},{"id":"e719a313.c7d78","type":"hubitat command","z":"4e1e6fde.a5bbf","name":"Main Hub - Zwave / OZWA","server":"7631dfd4.02862","deviceId":"","command":"","commandArgs":"","x":540,"y":240,"wires":[["ef3ddba.1057c28"]]},{"id":"e65b768b.ab1f68","type":"hubitat command","z":"4e1e6fde.a5bbf","name":"Main Hub C7 / MNZW","server":"106ae29b.a1d83d","deviceId":"","command":"","commandArgs":"","x":520,"y":360,"wires":[["47e952f6.d8d37c"]]},{"id":"ddcc8d55.8b128","type":"hubitat command","z":"4e1e6fde.a5bbf","name":"Upstairs Hub / OUPS","server":"925818a7.4a4018","deviceId":"","command":"","commandArgs":"","x":520,"y":300,"wires":[["b706dd3b.cf87a"]]},{"id":"7c32f9e4.9fd4f8","type":"change","z":"4e1e6fde.a5bbf","name":"hub = CTRL","rules":[{"t":"set","p":"hub","pt":"msg","to":"CTRL","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":830,"y":60,"wires":[[]]},{"id":"e076de00.f88b6","type":"change","z":"4e1e6fde.a5bbf","name":"hub = OMNF","rules":[{"t":"set","p":"hub","pt":"msg","to":"OMNF","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":830,"y":120,"wires":[[]]},{"id":"320acf5d.6b427","type":"change","z":"4e1e6fde.a5bbf","name":"hub = OZIG","rules":[{"t":"set","p":"hub","pt":"msg","to":"OZIG","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":830,"y":180,"wires":[[]]},{"id":"ef3ddba.1057c28","type":"change","z":"4e1e6fde.a5bbf","name":"hub = OZWA","rules":[{"t":"set","p":"hub","pt":"msg","to":"OZWA","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":830,"y":240,"wires":[[]]},{"id":"47e952f6.d8d37c","type":"change","z":"4e1e6fde.a5bbf","name":"hub = MNZW","rules":[{"t":"set","p":"hub","pt":"msg","to":"MNZW","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":830,"y":360,"wires":[[]]},{"id":"b47983a7.7b5f7","type":"switch","z":"4e1e6fde.a5bbf","name":"hub = CTRL \\n hub = OMNF \\n hub = OZIG \\n hub = OZWA \\n hub = OUPS \\n hub = MNZW","property":"hub","propertyType":"msg","rules":[{"t":"eq","v":"CTRL","vt":"str"},{"t":"eq","v":"OMNF","vt":"str"},{"t":"eq","v":"OZIG","vt":"str"},{"t":"eq","v":"OZWA","vt":"str"},{"t":"eq","v":"OUPS","vt":"str"},{"t":"eq","v":"MNZW","vt":"str"}],"checkall":"true","repair":false,"outputs":6,"x":190,"y":200,"wires":[["fb597717.109328"],["2a44d5ee.875b7a"],["448a391d.a21278"],["e719a313.c7d78"],["ddcc8d55.8b128"],["e65b768b.ab1f68"]]},{"id":"b706dd3b.cf87a","type":"change","z":"4e1e6fde.a5bbf","name":"hub = OUPS","rules":[{"t":"set","p":"hub","pt":"msg","to":"OUPS","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":830,"y":300,"wires":[[]]},{"id":"5f0d4ee4.54595","type":"subflow","name":"DevGrpCommand","info":"","category":"","in":[{"x":20,"y":80,"wires":[{"id":"12bc27d.a7615d8"}]}],"out":[{"x":1640,"y":80,"wires":[{"id":"5033935.2de806c","port":0}]}],"env":[{"name":"TOPIC","type":"str","value":"swGroupName"},{"name":"DEVICES","type":"str","value":""},{"name":"TYPE","type":"str","value":"switch"}],"color":"#DDAA99","status":{"x":1640,"y":220,"wires":[{"id":"eb697deb.09311","port":0}]}},{"id":"12bc27d.a7615d8","type":"switch","z":"5f0d4ee4.54595","name":"does msg.command exist \\n and is on/off?","property":"$exists(command) ? \t    ($contains(command,/(on)|(off)/) ? true : false )\t: false\t\t","propertyType":"jsonata","rules":[{"t":"true"},{"t":"false"}],"checkall":"true","repair":false,"outputs":2,"x":210,"y":80,"wires":[["5716210f.80d6f"],[]]},{"id":"fd492199.dfaea","type":"join","z":"5f0d4ee4.54595","name":"","mode":"auto","build":"string","property":"payload","propertyType":"msg","key":"topic","joiner":"\\n","joinerType":"str","accumulate":false,"timeout":"","count":"","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":650,"y":140,"wires":[["5033935.2de806c"]]},{"id":"5033935.2de806c","type":"change","z":"5f0d4ee4.54595","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload_send","tot":"msg"},{"t":"delete","p":"deviceId","pt":"msg"},{"t":"delete","p":"payload_send","pt":"msg"},{"t":"delete","p":"response","pt":"msg"},{"t":"set","p":"topic","pt":"msg","to":"TOPIC","tot":"env"}],"action":"","property":"","from":"","to":"","reg":false,"x":900,"y":140,"wires":[["eb697deb.09311"]]},{"id":"eb697deb.09311","type":"change","z":"5f0d4ee4.54595","name":"payload = payload.value","rules":[{"t":"set","p":"payload","pt":"msg","to":"\t{\t\"fill\": (payload.value = \"on\" ? \"green\" : (payload.value = \"off\" ? \"blue\" : \"black\")),\t\"shape\":\"dot\",\t\"text\":'Command: \"' & payload.value & '\"'\t}\t","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":1410,"y":220,"wires":[[]]},{"id":"caefe429.207cc8","type":"subflow:4e1e6fde.a5bbf","z":"5f0d4ee4.54595","name":"","env":[],"x":450,"y":140,"wires":[["fd492199.dfaea"]]},{"id":"5716210f.80d6f","type":"function","z":"5f0d4ee4.54595","name":"Gen related device msgs","func":"// walk thru device list and set commands\ndevList = env.get(\"DEVICES\");\ndevices = devList.split(\",\");\ntopic = env.get(\"TOPIC\");\nlen = devices.length;\n\nvar icnt = 0;\ndevices.forEach( o => {\n        var dev = o.split(\"/\");\n        var hub = dev[0];\n        var devId = dev[1];\n\n        var parts = {\n            \"id\":topic,\n            \"index\": icnt,\n            \"count\": len,\n            \"type\":\"object\",\n            \"ch\":\"\",\n            \"key\": o,\n            \"len\":\"\"\n        }\n\n        var newPayld = {\n            \"name\": \"switch\",\n            \"value\": msg.command,\n            \"displayName\": topic,\n            \"deviceId\": devList,\n            \"descriptionText\": topic,\n            \"unit\": null,\n            \"type\": null,\n            \"data\": null\n        };\n\n        icnt++;\n        msg.parts = parts;\n        msg.deviceId = devId;\n        msg.payload = {\"deviceId\": devId};\n        msg.payload_send = newPayld;\n        msg.hub = hub;\n        \n        //node.warn(o)\n\n        node.send(msg);\n    }\n);\n\n\n\nreturn;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":470,"y":80,"wires":[["caefe429.207cc8"]]},{"id":"9e28a145.80b4c","type":"subflow","name":"HubGrpRequest","info":"","category":"","in":[{"x":80,"y":200,"wires":[{"id":"8ef7fcff.46751"}]}],"out":[{"x":1140,"y":200,"wires":[{"id":"9abab016.1391","port":0},{"id":"ec167371.9e589","port":0},{"id":"40eaa66d.4bd218","port":0},{"id":"ef08a287.f93b4","port":0},{"id":"368409fd.864856","port":0},{"id":"ee11f083.f9355","port":0}]}],"env":[],"color":"#DDAA99"},{"id":"9abab016.1391","type":"change","z":"9e28a145.80b4c","name":"hub = CTRL","rules":[{"t":"set","p":"hub","pt":"msg","to":"CTRL","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":850,"y":60,"wires":[[]]},{"id":"ec167371.9e589","type":"change","z":"9e28a145.80b4c","name":"hub = OMNF","rules":[{"t":"set","p":"hub","pt":"msg","to":"OMNF","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":850,"y":120,"wires":[[]]},{"id":"40eaa66d.4bd218","type":"change","z":"9e28a145.80b4c","name":"hub = OZIG","rules":[{"t":"set","p":"hub","pt":"msg","to":"OZIG","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":850,"y":180,"wires":[[]]},{"id":"ef08a287.f93b4","type":"change","z":"9e28a145.80b4c","name":"hub = OZWA","rules":[{"t":"set","p":"hub","pt":"msg","to":"OZWA","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":850,"y":240,"wires":[[]]},{"id":"ee11f083.f9355","type":"change","z":"9e28a145.80b4c","name":"hub = MNZW","rules":[{"t":"set","p":"hub","pt":"msg","to":"MNZW","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":850,"y":360,"wires":[[]]},{"id":"1f8cc23e.0b944e","type":"hubitat request","z":"9e28a145.80b4c","name":"Control Hub / CTRL","server":"bc9b2ba4.2458c8","path":"","x":570,"y":60,"wires":[["9abab016.1391"]]},{"id":"8ef7fcff.46751","type":"switch","z":"9e28a145.80b4c","name":"hub = CTRL \\n hub = OMNF \\n hub = OZIG \\n hub = OZWA \\n hub = OUPS \\n hub = MNZW","property":"hub","propertyType":"msg","rules":[{"t":"eq","v":"CTRL","vt":"str"},{"t":"eq","v":"OMNF","vt":"str"},{"t":"eq","v":"OZIG","vt":"str"},{"t":"eq","v":"OZWA","vt":"str"},{"t":"eq","v":"OUPS","vt":"str"},{"t":"eq","v":"MNZW","vt":"str"}],"checkall":"true","repair":false,"outputs":6,"x":290,"y":200,"wires":[["1f8cc23e.0b944e"],["ccd2f8bb.864ac8"],["c875db14.d98708"],["d62999a5.474738"],["ee51458c.5f4338"],["1ef39202.40cbbe"]]},{"id":"ccd2f8bb.864ac8","type":"hubitat request","z":"9e28a145.80b4c","name":"Main Hub / OMNF","server":"5664ca29.3af904","path":"","x":570,"y":120,"wires":[["ec167371.9e589"]]},{"id":"c875db14.d98708","type":"hubitat request","z":"9e28a145.80b4c","name":"Main Hub - Zigbee / OZIG","server":"623daead.b1d2b","path":"","x":590,"y":180,"wires":[["40eaa66d.4bd218"]]},{"id":"d62999a5.474738","type":"hubitat request","z":"9e28a145.80b4c","name":"Main Hub - Zwave / OZWA","server":"7631dfd4.02862","path":"","x":600,"y":240,"wires":[["ef08a287.f93b4"]]},{"id":"1ef39202.40cbbe","type":"hubitat request","z":"9e28a145.80b4c","name":"Main Hub C7 / MNZW","server":"106ae29b.a1d83d","path":"","x":580,"y":360,"wires":[["ee11f083.f9355"]]},{"id":"368409fd.864856","type":"change","z":"9e28a145.80b4c","name":"hub = OUPS","rules":[{"t":"set","p":"hub","pt":"msg","to":"OUPS","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":850,"y":300,"wires":[[]]},{"id":"ee51458c.5f4338","type":"hubitat request","z":"9e28a145.80b4c","name":"Upstairs Hub / OUPS","server":"925818a7.4a4018","path":"","x":580,"y":300,"wires":[["368409fd.864856"]]},{"id":"925818a7.4a4018","type":"hubitat config","name":"Upstairs Hub","usetls":false,"host":"0.0.0.0","port":"80","appId":"000","nodeRedServer":"http://0.0.0.0:1880","webhookPath":"/hubitat/webhook_upstairs","autoRefresh":true,"useWebsocket":false},{"id":"52da5ceb.f5efa4","type":"subflow","name":"HubGrpEvents","info":"","category":"","in":[],"out":[{"x":940,"y":180,"wires":[{"id":"fecb2a55.280378","port":0},{"id":"190e2933.bc97c7","port":0},{"id":"7f4e9570.890b4c","port":0},{"id":"8f1321f9.9cb4b","port":0},{"id":"fb90e9a9.67a1a8","port":0}]}],"env":[],"color":"#DDAA99"},{"id":"5ee947d2.aac928","type":"hubitat event","z":"52da5ceb.f5efa4","name":"Control Hub - CTRL","server":"bc9b2ba4.2458c8","x":190,"y":80,"wires":[["fecb2a55.280378"]]},{"id":"dd1d273.772d9d8","type":"hubitat event","z":"52da5ceb.f5efa4","name":"Main Hub / OMNF","server":"5664ca29.3af904","x":190,"y":140,"wires":[["190e2933.bc97c7"]]},{"id":"da0c1a72.241788","type":"hubitat event","z":"52da5ceb.f5efa4","name":"Main Hub - Zigbee / OZIG","server":"623daead.b1d2b","x":210,"y":200,"wires":[["7f4e9570.890b4c"]]},{"id":"226988d4.2fbc28","type":"hubitat event","z":"52da5ceb.f5efa4","name":"Main Hub - Zwave / OZWA","server":"7631dfd4.02862","x":210,"y":260,"wires":[["8f1321f9.9cb4b"]]},{"id":"2dada7ec.57be98","type":"hubitat event","z":"52da5ceb.f5efa4","name":"Main Hub C7 / MNZW","server":"106ae29b.a1d83d","x":200,"y":320,"wires":[["fb90e9a9.67a1a8"]]},{"id":"fecb2a55.280378","type":"change","z":"52da5ceb.f5efa4","name":"hub = CTRL","rules":[{"t":"set","p":"hub","pt":"msg","to":"CTRL","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":470,"y":80,"wires":[[]]},{"id":"190e2933.bc97c7","type":"change","z":"52da5ceb.f5efa4","name":"hub = OMNF","rules":[{"t":"set","p":"hub","pt":"msg","to":"OMNF","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":470,"y":140,"wires":[[]]},{"id":"7f4e9570.890b4c","type":"change","z":"52da5ceb.f5efa4","name":"hub = OZIG","rules":[{"t":"set","p":"hub","pt":"msg","to":"OZIG","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":470,"y":200,"wires":[[]]},{"id":"8f1321f9.9cb4b","type":"change","z":"52da5ceb.f5efa4","name":"hub = OZWA","rules":[{"t":"set","p":"hub","pt":"msg","to":"OZWA","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":470,"y":260,"wires":[[]]},{"id":"fb90e9a9.67a1a8","type":"change","z":"52da5ceb.f5efa4","name":"hub = MNZW","rules":[{"t":"set","p":"hub","pt":"msg","to":"MNZW","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":470,"y":320,"wires":[[]]},{"id":"bc9b2ba4.2458c8","type":"hubitat config","name":"Control Hub","usetls":false,"host":"0.0.0.0","port":"80","appId":"000","nodeRedServer":"http://0.0.0.0:1880","webhookPath":"/hubitat/webhook_control","autoRefresh":false,"useWebsocket":false},{"id":"5664ca29.3af904","type":"hubitat config","name":"Main Hub","usetls":false,"host":"0.0.0.0","port":"80","appId":"000","nodeRedServer":"http://0.0.0.0:1880","webhookPath":"/hubitat/webhook","autoRefresh":true,"useWebsocket":false},{"id":"623daead.b1d2b","type":"hubitat config","name":"Main Hub - Zigbee","usetls":false,"host":"0.0.0.0","port":"80","appId":"000","nodeRedServer":"http://0.0.0.0:1880","webhookPath":"/hubitat/webhook_main_zigbee","autoRefresh":true,"useWebsocket":false},{"id":"7631dfd4.02862","type":"hubitat config","name":"Main Hub - Zwave","usetls":false,"host":"0.0.0.0","port":"80","appId":"000","nodeRedServer":"http://0.0.0.0:1880","webhookPath":"/hubitat/webhook_main_zwave","autoRefresh":true,"useWebsocket":false},{"id":"106ae29b.a1d83d","type":"hubitat config","name":"Main Hub C7","usetls":false,"host":"0.0.0.0","port":"80","appId":"000","nodeRedServer":"http://0.0.0.0:1880","webhookPath":"/hubitat/webhook_c7","autoRefresh":true,"useWebsocket":false},{"id":"7e71de96.77727","type":"subflow","name":"DevGrpEvent","info":"","category":"","in":[{"x":60,"y":120,"wires":[{"id":"2feace6b.d14dc2"}]}],"out":[{"x":1720,"y":200,"wires":[{"id":"db3390b.b70b57","port":0},{"id":"ee37dbfb.f47708","port":0}]},{"x":1720,"y":280,"wires":[{"id":"26ad91b7.ae866e","port":0}]}],"env":[{"name":"TOPIC","type":"str","value":"swGroupName"},{"name":"DEVICES","type":"str","value":""},{"name":"TYPE","type":"str","value":"switch"},{"name":"ACTIONS","type":"str","value":"on/off"},{"name":"ALL_ACTION1","type":"bool","value":"true"},{"name":"ALL_ACTION2","type":"bool","value":"true"},{"name":"SEND_EVENTS","type":"bool","value":"true"}],"color":"#DDAA99","status":{"x":1720,"y":360,"wires":[{"id":"26ad91b7.ae866e","port":0}]}},{"id":"fb5a0d32.35fce","type":"switch","z":"7e71de96.77727","name":"does event match specified deviceId?","property":"DEVICES","propertyType":"env","rules":[{"t":"cont","v":"hub & \"/\" & payload.deviceId","vt":"jsonata"}],"checkall":"true","repair":false,"outputs":1,"x":1070,"y":40,"wires":[["81abc8d5.998a58"]]},{"id":"778ec673.85ac28","type":"function","z":"7e71de96.77727","name":"Gen related device msgs","func":"// walk thru device list and set commands\ndevices = env.get(\"DEVICES\").split(\",\");\ntopic = env.get(\"TOPIC\");\nlen = devices.length;\nflow.set(\"State_MAX\", len);\n\n\nvar icnt = 0;\ndevices.forEach( o => {\n        var dev = o.split(\"/\");\n        var hub = dev[0];\n        var device = dev[1];\n        var path = \"/devices/\" + device;\n        var parts = {\n            \"id\":topic,\n            \"index\": icnt,\n            \"count\": len,\n            \"type\":\"object\",\n            \"ch\":\"\",\n            \"key\": o,\n            \"len\":\"\"\n        }\n        \n        icnt++;\n        msg.topic = topic;\n        msg.path = path;\n        msg.parts = parts;\n        msg.hub = hub\n\n        \n        node.send(msg);\n    }\n);\n\n\n\nreturn;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":150,"y":220,"wires":[["61c08ebe.0a8ba"]]},{"id":"61c08ebe.0a8ba","type":"delay","z":"7e71de96.77727","name":"","pauseType":"random","timeout":"5","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"50","randomUnits":"milliseconds","drop":false,"x":360,"y":220,"wires":[["836e4fce.3b2e"]]},{"id":"c9807839.b005f8","type":"join","z":"7e71de96.77727","name":"","mode":"auto","build":"string","property":"payload","propertyType":"msg","key":"topic","joiner":"\\n","joinerType":"str","accumulate":false,"timeout":"","count":"","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":970,"y":220,"wires":[["392ba79a.a06c58"]]},{"id":"81abc8d5.998a58","type":"change","z":"7e71de96.77727","name":"Initialize flow vars","rules":[{"t":"set","p":"State_1","pt":"flow","to":"0","tot":"jsonata"},{"t":"set","p":"State_2","pt":"flow","to":"0","tot":"jsonata"},{"t":"set","p":"State_MAX","pt":"flow","to":"0","tot":"jsonata"},{"t":"set","p":"devices","pt":"flow","to":"{\"devList\":[]}","tot":"json"}],"action":"","property":"","from":"","to":"","reg":false,"x":710,"y":120,"wires":[["778ec673.85ac28"]]},{"id":"392ba79a.a06c58","type":"change","z":"7e71de96.77727","name":"","rules":[{"t":"set","p":"state.State_1","pt":"msg","to":"State_1","tot":"flow"},{"t":"set","p":"state.State_2","pt":"msg","to":"State_2","tot":"flow"},{"t":"set","p":"state.State_MAX","pt":"msg","to":"State_MAX","tot":"flow"}],"action":"","property":"","from":"","to":"","reg":false,"x":780,"y":300,"wires":[["e0050d3.909bbf"]]},{"id":"b6398b5.f1c4978","type":"function","z":"7e71de96.77727","name":"accumulate stats","func":"\nvar state1 = flow.get(\"State_1\");\nvar state2 = flow.get(\"State_2\");\nvar devType = env.get(\"TYPE\");\nvar actions = env.get(\"ACTIONS\").split(\"/\");\nvar retMsg;\nvar hub = msg.hub;\nvar devId = hub + \"/\" + msg.payload.id;\nvar dev = flow.get(\"devices\");\n\n\nvar devList = [];\n\nif (dev) {\n    devList = dev.devList;\n}\n\n//node.warn(devList);\n\n\nif (!devList.includes(devId)) {\n    \n    devList.push(devId);\n    dev.devList = devList;\n    flow.set(\"devices\",dev);\n    \n    // set flow counting vars\n    var attr = msg.payload.attributes;\n    //node.warn(attr);\n    var osw = attr.find(od => od.name === devType );\n    msg.payload.value = osw.currentValue;\n    \n    if (osw.currentValue === actions[0]) {\n        state1++;\n        flow.set(\"State_1\",state1);\n    } else if (osw.currentValue === actions[1]) {\n        state2++;\n        flow.set(\"State_2\",state2);\n    }\n    \n    // strip \"path\"/\"hub\" for tidiness\n    delete msg.path;\n    delete msg.hub;\n    \n    retMsg = msg;\n}\n\n\nreturn retMsg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":790,"y":220,"wires":[["c9807839.b005f8"]]},{"id":"e0050d3.909bbf","type":"function","z":"7e71de96.77727","name":"Set payload","func":"var topic = env.get(\"TOPIC\");\nvar devices = env.get(\"DEVICES\");\nvar bAll1 = env.get(\"ALL_ACTION1\");\nvar bAll2 = env.get(\"ALL_ACTION2\");\nvar devType = env.get(\"TYPE\");\nvar actions = env.get(\"ACTIONS\").split(\"/\");\n\n\nvar cnt1 = msg.state.State_1;\nvar cnt2 = msg.state.State_2;\nvar cntNum = msg.state.State_MAX;\nvar calcVal = \"\";\n\nvar newPayld = {\n    \"name\": topic,\n    \"currentValue\": \"\",\n    \"value\": \"\",\n    \"displayName\": topic,\n    \"dataType\": \"ENUM\",\t\n    \"values\": {\"0\":actions[0],\"1\":actions[1]},\n    \"deviceId\": devices\n};\n\nif ( bAll1 && bAll2 ){\n    if (cnt1 === cntNum){\n        calcVal = actions[0];\n    } else if (cnt2 === cntNum){\n        calcVal = actions[1];\n    } else {\n        calcVal = \"pending\";\n    }\n}\nelse if ( bAll1 && !bAll2 ){\n    if (cnt1 === cntNum){\n        calcVal = actions[0];\n    } else {\n        calcVal = actions[1];\n    }\n    \n}\nelse if ( !bAll1 && bAll2 ){\n    if (cnt2 === cntNum){\n        calcVal = actions[1];\n    } else {\n        calcVal = actions[0];\n    }\n    \n}\nelse{\n    calcVal = \"undefined\";\n}\n\nnewPayld.value = calcVal\nnewPayld.currentValue = calcVal\n\nmsg.topic = topic\nmsg.payload = newPayld\n\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":990,"y":300,"wires":[["26ad91b7.ae866e","ee37dbfb.f47708"]]},{"id":"e82be6d9.b86718","type":"switch","z":"7e71de96.77727","name":"SEND_EVENTS = true?","property":"SEND_EVENTS","propertyType":"env","rules":[{"t":"true"}],"checkall":"true","repair":false,"outputs":1,"x":390,"y":40,"wires":[["bc8384ad.287788"]]},{"id":"db3390b.b70b57","type":"rbe","z":"7e71de96.77727","name":"","func":"rbe","gap":"","start":"","inout":"out","property":"payload.value","x":1530,"y":260,"wires":[[]]},{"id":"f79df937.2dc538","type":"switch","z":"7e71de96.77727","name":"value != pending and != undefined","property":"true","propertyType":"jsonata","rules":[{"t":"eq","v":"payload.value != \"pending\" and payload.value != \"undefined\"","vt":"jsonata"}],"checkall":"true","repair":false,"outputs":1,"x":1300,"y":260,"wires":[["db3390b.b70b57"]]},{"id":"26ad91b7.ae866e","type":"function","z":"7e71de96.77727","name":"set status payload","func":"/*\n\n{\n\"fill\": (payload.value = \"on\" ? \"green\" : (payload.value = \"off\" ? \"blue\" : \"black\")),\n\"shape\":\"dot\",\n\"text\":'Status: \"' & payload.value & '\"'\n}\n\n*/\n\n\nvar devType = env.get(\"TYPE\");\nvar actions = env.get(\"ACTIONS\").split(\"/\");\n\nvar payload = {\n\"fill\": (msg.payload.value === actions[0] ? \"green\" : (msg.payload.value === actions[1] ? \"blue\" : \"black\")),\n\"shape\":\"dot\",\n\"text\":'Status: \"' + msg.payload.value + '\"'\n};\n\nmsg.payload = payload;\n\n\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":1250,"y":360,"wires":[[]]},{"id":"ee37dbfb.f47708","type":"switch","z":"7e71de96.77727","name":"override = true/false","property":"override","propertyType":"flow","rules":[{"t":"true"},{"t":"else"}],"checkall":"true","repair":false,"outputs":2,"x":1260,"y":200,"wires":[[],["f79df937.2dc538"]]},{"id":"2feace6b.d14dc2","type":"change","z":"7e71de96.77727","name":"override = true","rules":[{"t":"set","p":"override","pt":"flow","to":"true","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":280,"y":120,"wires":[["81abc8d5.998a58"]]},{"id":"bc8384ad.287788","type":"change","z":"7e71de96.77727","name":"override = false","rules":[{"t":"set","p":"override","pt":"flow","to":"false","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":700,"y":40,"wires":[["fb5a0d32.35fce"]]},{"id":"ff11f9ac.a1dc08","type":"subflow:52da5ceb.f5efa4","z":"7e71de96.77727","name":"","x":120,"y":40,"wires":[["e82be6d9.b86718"]]},{"id":"836e4fce.3b2e","type":"subflow:9e28a145.80b4c","z":"7e71de96.77727","name":"","x":540,"y":220,"wires":[["b6398b5.f1c4978"]]},{"id":"29102dd4.c88fb2","type":"debug","z":"af91369d.586338","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":670,"y":500,"wires":[]},{"id":"9b30373e.7864f8","type":"inject","z":"af91369d.586338","name":"On","props":[{"p":"command","v":"on","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":110,"y":480,"wires":[["f1c84278.5de4b"]]},{"id":"33147b0b.f47114","type":"inject","z":"af91369d.586338","name":"Off","props":[{"p":"command","v":"off","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":110,"y":520,"wires":[["f1c84278.5de4b"]]},{"id":"520a03bd.66998c","type":"debug","z":"af91369d.586338","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":670,"y":420,"wires":[]},{"id":"220cdb4f.808114","type":"subflow:7e71de96.77727","z":"af91369d.586338","name":"","env":[{"name":"TOPIC","value":"OfficeLights","type":"str"},{"name":"DEVICES","value":"OZIG/1773,OZIG/1774","type":"str"},{"name":"SEND_EVENTS","value":"false","type":"bool"}],"x":380,"y":420,"wires":[["520a03bd.66998c"],[]]},{"id":"f1c84278.5de4b","type":"subflow:5f0d4ee4.54595","z":"af91369d.586338","name":"","env":[{"name":"TOPIC","value":"OfficeLights","type":"str"},{"name":"DEVICES","value":"OZIG/1773,OZIG/1774","type":"str"}],"x":390,"y":500,"wires":[["29102dd4.c88fb2"]]},{"id":"70412c3c.829824","type":"debug","z":"af91369d.586338","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":670,"y":560,"wires":[]},{"id":"dff81a81.d917c8","type":"subflow:7e71de96.77727","z":"af91369d.586338","name":"","env":[{"name":"TOPIC","value":"OfficeLights","type":"str"},{"name":"DEVICES","value":"OZIG/1773,OZIG/1774","type":"str"}],"x":380,"y":560,"wires":[["70412c3c.829824"],[]]},{"id":"2d55ccab.9fa964","type":"inject","z":"af91369d.586338","name":"nothing","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"nothing","payloadType":"str","x":110,"y":420,"wires":[["220cdb4f.808114"]]}]
Groupings in NR - Further tweaks and updates. 11/30/20

[{"id":"4e1e6fde.a5bbf","type":"subflow","name":"HubGrpCommand","info":"","category":"","in":[{"x":40,"y":40,"wires":[{"id":"b47983a7.7b5f7"}]}],"out":[{"x":1220,"y":180,"wires":[{"id":"e076de00.f88b6","port":0},{"id":"320acf5d.6b427","port":0},{"id":"b706dd3b.cf87a","port":0},{"id":"47e952f6.d8d37c","port":0}]}],"env":[],"color":"#FC7A5E"},{"id":"2a44d5ee.875b7a","type":"hubitat command","z":"4e1e6fde.a5bbf","name":"Main Hub / OLDMAIN","server":"5664ca29.3af904","deviceId":"","command":"","commandArgs":"","x":520,"y":120,"wires":[["e076de00.f88b6"]]},{"id":"448a391d.a21278","type":"hubitat command","z":"4e1e6fde.a5bbf","name":"Main Hub - Zigbee / OLDZIGB","server":"623daead.b1d2b","deviceId":"","command":"","commandArgs":"","x":550,"y":180,"wires":[["320acf5d.6b427"]]},{"id":"e65b768b.ab1f68","type":"hubitat command","z":"4e1e6fde.a5bbf","name":"Main Hub C7 / MAIN","server":"106ae29b.a1d83d","deviceId":"","command":"","commandArgs":"","x":520,"y":300,"wires":[["47e952f6.d8d37c"]]},{"id":"ddcc8d55.8b128","type":"hubitat command","z":"4e1e6fde.a5bbf","name":"Upstairs Hub / UPSTAIRS","server":"925818a7.4a4018","deviceId":"","command":"","commandArgs":"","x":530,"y":240,"wires":[["b706dd3b.cf87a"]]},{"id":"e076de00.f88b6","type":"change","z":"4e1e6fde.a5bbf","name":"hub = OLDMAIN","rules":[{"t":"set","p":"hub","pt":"msg","to":"OLDMAIN","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":840,"y":120,"wires":[[]]},{"id":"320acf5d.6b427","type":"change","z":"4e1e6fde.a5bbf","name":"hub = OLDZIGB","rules":[{"t":"set","p":"hub","pt":"msg","to":"OLDZIGB","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":840,"y":180,"wires":[[]]},{"id":"47e952f6.d8d37c","type":"change","z":"4e1e6fde.a5bbf","name":"hub = MAIN","rules":[{"t":"set","p":"hub","pt":"msg","to":"MAIN","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":830,"y":300,"wires":[[]]},{"id":"b47983a7.7b5f7","type":"switch","z":"4e1e6fde.a5bbf","name":"hub = OLDMAIN \\n hub = OLDZIGB \\n hub = UPSTAIRS \\n hub = MAIN","property":"hub","propertyType":"msg","rules":[{"t":"eq","v":"OLDMAIN","vt":"str"},{"t":"eq","v":"OLDZIGB","vt":"str"},{"t":"eq","v":"UPSTAIRS","vt":"str"},{"t":"eq","v":"MAIN","vt":"str"}],"checkall":"true","repair":false,"outputs":4,"x":210,"y":200,"wires":[["2a44d5ee.875b7a"],["448a391d.a21278"],["ddcc8d55.8b128"],["e65b768b.ab1f68"]]},{"id":"b706dd3b.cf87a","type":"change","z":"4e1e6fde.a5bbf","name":"hub = UPSTAIRS","rules":[{"t":"set","p":"hub","pt":"msg","to":"UPSTAIRS","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":850,"y":240,"wires":[[]]},{"id":"5f0d4ee4.54595","type":"subflow","name":"DevGrpCommand","info":"","category":"","in":[{"x":20,"y":80,"wires":[{"id":"12bc27d.a7615d8"}]}],"out":[{"x":1520,"y":140,"wires":[{"id":"5033935.2de806c","port":0}]}],"env":[{"name":"TOPIC","type":"str","value":"swGroupName"},{"name":"DEVICES","type":"str","value":""},{"name":"TYPE","type":"str","value":"switch"},{"name":"ACTION","type":"str","value":"on/off"}],"color":"#FC7A5E","icon":"node-red-contrib-hubitat/command.svg","status":{"x":1520,"y":220,"wires":[{"id":"eb697deb.09311","port":0}]}},{"id":"12bc27d.a7615d8","type":"switch","z":"5f0d4ee4.54595","name":"does msg.command exist \\n and exists within ACTION?","property":"$exists(command) ? \t    ($contains($env(\"ACTION\"),command) ? true : false )\t: false\t\t","propertyType":"jsonata","rules":[{"t":"true"},{"t":"false"}],"checkall":"true","repair":false,"outputs":2,"x":200,"y":80,"wires":[["5716210f.80d6f"],[]]},{"id":"fd492199.dfaea","type":"join","z":"5f0d4ee4.54595","name":"","mode":"auto","build":"string","property":"payload","propertyType":"msg","key":"topic","joiner":"\\n","joinerType":"str","accumulate":false,"timeout":"","count":"","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":790,"y":140,"wires":[["5033935.2de806c"]]},{"id":"5033935.2de806c","type":"change","z":"5f0d4ee4.54595","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload_send","tot":"msg"},{"t":"delete","p":"deviceId","pt":"msg"},{"t":"delete","p":"payload_send","pt":"msg"},{"t":"delete","p":"response","pt":"msg"},{"t":"set","p":"topic","pt":"msg","to":"TOPIC","tot":"env"}],"action":"","property":"","from":"","to":"","reg":false,"x":1000,"y":140,"wires":[["eb697deb.09311"]]},{"id":"eb697deb.09311","type":"change","z":"5f0d4ee4.54595","name":"payload = payload.value","rules":[{"t":"set","p":"payload","pt":"msg","to":"\t{\t\"fill\": (payload.value = \"on\" ? \"green\" : (payload.value = \"off\" ? \"blue\" : \"black\")),\t\"shape\":\"dot\",\t\"text\":'Command: \"' & payload.value & '\"'\t}\t","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":1270,"y":220,"wires":[[]]},{"id":"caefe429.207cc8","type":"subflow:4e1e6fde.a5bbf","z":"5f0d4ee4.54595","name":"","env":[],"x":510,"y":140,"wires":[["fd492199.dfaea"]]},{"id":"5716210f.80d6f","type":"function","z":"5f0d4ee4.54595","name":"Gen related device msgs","func":"// walk thru device list and set commands\n\nvar topic = env.get(\"TOPIC\");\nvar devList = env.get(\"DEVICES\");\n//var devices = devList.split(\",\");\n// devices = env.get(\"DEVICES\").split(\",\");\n\n// if passing devices via deviceId \nif (msg.deviceId) {\n    devList = msg.deviceId;\n}\n\nvar devices;\nvar isString;\nif (typeof devList === \"string\") {\n    isString = true;\n    devices = devList.split(\",\");\n} else {\n    isString = false;\n    devices = devList;\n}\n\nvar len = devices.length;\n\nvar icnt = 0;\ndevices.forEach( o => {\n\n    // var dev = o.split(\"/\");\n    // var hub = dev[0];\n    // var devId = dev[1];\n    var hub;\n    var devId;\n    var key;\n\n\n    if( isString ) { \n        var dev = o.split(\"/\");\n        hub = dev[0];\n        devId = dev[1];\n        key = o;\n    } else {\n        hub = o.hub;\n        devId = o.deviceId;\n        key = o.hub + \"/\" + o.deviceId;\n    }\n\n\n    var parts = {\n        \"id\":topic,\n        \"index\": icnt,\n        \"count\": len,\n        \"type\":\"object\",\n        \"ch\":\"\",\n        \"key\": key,\n        \"len\":\"\"\n    }\n\n    var newPayld = {\n        \"name\": \"switch\",\n        \"value\": msg.command,\n        \"displayName\": topic,\n        \"deviceId\": devList,\n        \"descriptionText\": topic,\n        \"unit\": null,\n        \"type\": null,\n        \"data\": null\n    };\n\n    icnt++;\n    msg.parts = parts;\n    msg.deviceId = devId;\n    msg.payload = {\"deviceId\": devId};\n    msg.payload_send = newPayld;\n    msg.hub = hub;\n    \n    //node.warn(o)\n\n    node.send(msg);\n}\n);\n\n\n\nreturn;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":530,"y":80,"wires":[["caefe429.207cc8"]]},{"id":"9e28a145.80b4c","type":"subflow","name":"HubGrpRequest","info":"","category":"","in":[{"x":80,"y":200,"wires":[{"id":"8ef7fcff.46751"}]}],"out":[{"x":1140,"y":200,"wires":[{"id":"ec167371.9e589","port":0},{"id":"40eaa66d.4bd218","port":0},{"id":"368409fd.864856","port":0},{"id":"ee11f083.f9355","port":0}]}],"env":[],"color":"#FC7A5E"},{"id":"ec167371.9e589","type":"change","z":"9e28a145.80b4c","name":"hub = OLDMAIN","rules":[{"t":"set","p":"hub","pt":"msg","to":"OLDMAIN","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":860,"y":120,"wires":[[]]},{"id":"40eaa66d.4bd218","type":"change","z":"9e28a145.80b4c","name":"hub = OLDZIGB","rules":[{"t":"set","p":"hub","pt":"msg","to":"OLDZIGB","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":860,"y":180,"wires":[[]]},{"id":"ee11f083.f9355","type":"change","z":"9e28a145.80b4c","name":"hub = MAIN","rules":[{"t":"set","p":"hub","pt":"msg","to":"MAIN","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":850,"y":300,"wires":[[]]},{"id":"8ef7fcff.46751","type":"switch","z":"9e28a145.80b4c","name":"hub = OLDMAIN \\n hub = OLDZIGB \\n hub = UPSTAIRS \\n hub = MAIN","property":"hub","propertyType":"msg","rules":[{"t":"eq","v":"OLDMAIN","vt":"str"},{"t":"eq","v":"OLDZIGB","vt":"str"},{"t":"eq","v":"UPSTAIRS","vt":"str"},{"t":"eq","v":"MAIN","vt":"str"}],"checkall":"false","repair":false,"outputs":4,"x":310,"y":200,"wires":[["ccd2f8bb.864ac8"],["c875db14.d98708"],["ee51458c.5f4338"],["1ef39202.40cbbe"]]},{"id":"ccd2f8bb.864ac8","type":"hubitat request","z":"9e28a145.80b4c","name":"Main Hub / OLDMAIN","server":"5664ca29.3af904","path":"","x":580,"y":120,"wires":[["ec167371.9e589"]]},{"id":"c875db14.d98708","type":"hubitat request","z":"9e28a145.80b4c","name":"Main Hub - Zigbee / OLDZIGB","server":"623daead.b1d2b","path":"","x":610,"y":180,"wires":[["40eaa66d.4bd218"]]},{"id":"1ef39202.40cbbe","type":"hubitat request","z":"9e28a145.80b4c","name":"Main Hub C7 / MAIN","server":"106ae29b.a1d83d","path":"","x":580,"y":300,"wires":[["ee11f083.f9355"]]},{"id":"368409fd.864856","type":"change","z":"9e28a145.80b4c","name":"hub = UPSTAIRS","rules":[{"t":"set","p":"hub","pt":"msg","to":"UPSTAIRS","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":870,"y":240,"wires":[[]]},{"id":"ee51458c.5f4338","type":"hubitat request","z":"9e28a145.80b4c","name":"Upstairs Hub / UPSTAIRS","server":"925818a7.4a4018","path":"","x":590,"y":240,"wires":[["368409fd.864856"]]},{"id":"52da5ceb.f5efa4","type":"subflow","name":"HubGrpEvents","info":"","category":"","in":[],"out":[{"x":940,"y":180,"wires":[{"id":"190e2933.bc97c7","port":0},{"id":"7f4e9570.890b4c","port":0},{"id":"fb90e9a9.67a1a8","port":0},{"id":"3360de68.b23be2","port":0}]}],"env":[],"color":"#FC7A5E"},{"id":"dd1d273.772d9d8","type":"hubitat event","z":"52da5ceb.f5efa4","name":"Main Hub / OLDMAIN","server":"5664ca29.3af904","x":200,"y":140,"wires":[["190e2933.bc97c7"]]},{"id":"da0c1a72.241788","type":"hubitat event","z":"52da5ceb.f5efa4","name":"Main Hub - Zigbee / OLDZIGB","server":"623daead.b1d2b","x":220,"y":200,"wires":[["7f4e9570.890b4c"]]},{"id":"2dada7ec.57be98","type":"hubitat event","z":"52da5ceb.f5efa4","name":"Main Hub C7 / MAIN","server":"106ae29b.a1d83d","x":190,"y":260,"wires":[["fb90e9a9.67a1a8"]]},{"id":"190e2933.bc97c7","type":"change","z":"52da5ceb.f5efa4","name":"hub = OLDMAIN","rules":[{"t":"set","p":"hub","pt":"msg","to":"OLDMAIN","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":520,"y":140,"wires":[[]]},{"id":"7f4e9570.890b4c","type":"change","z":"52da5ceb.f5efa4","name":"hub = OLDZIGB","rules":[{"t":"set","p":"hub","pt":"msg","to":"OLDZIGB","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":520,"y":200,"wires":[[]]},{"id":"fb90e9a9.67a1a8","type":"change","z":"52da5ceb.f5efa4","name":"hub = MAIN","rules":[{"t":"set","p":"hub","pt":"msg","to":"MAIN","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":510,"y":260,"wires":[[]]},{"id":"74b24021.1e4e4","type":"hubitat event","z":"52da5ceb.f5efa4","name":"Upstairs Hub / UPSTAIRS","server":"925818a7.4a4018","x":210,"y":80,"wires":[["3360de68.b23be2"]]},{"id":"3360de68.b23be2","type":"change","z":"52da5ceb.f5efa4","name":"hub = UPSTAIRS","rules":[{"t":"set","p":"hub","pt":"msg","to":"UPSTAIRS","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":530,"y":80,"wires":[[]]},{"id":"5664ca29.3af904","type":"hubitat config","name":"Main Hub","usetls":false,"host":"0.0.0.0","port":"80","appId":"000","nodeRedServer":"http://0.0.0.0:1880","webhookPath":"/hubitat/webhook","autoRefresh":true,"useWebsocket":false},{"id":"623daead.b1d2b","type":"hubitat config","name":"Main Hub - Zigbee","usetls":false,"host":"0.0.0.0","port":"80","appId":"000","nodeRedServer":"http://0.0.0.0:1880","webhookPath":"/hubitat/webhook_main_zigbee","autoRefresh":true,"useWebsocket":false},{"id":"106ae29b.a1d83d","type":"hubitat config","name":"Main Hub C7","usetls":false,"host":"0.0.0.0","port":"80","appId":"000","nodeRedServer":"http://0.0.0.0:1880","webhookPath":"/hubitat/webhook_c7","autoRefresh":true,"useWebsocket":false},{"id":"925818a7.4a4018","type":"hubitat config","name":"Upstairs Hub","usetls":false,"host":"0.0.0.0","port":"80","appId":"000","nodeRedServer":"http://0.0.0.0:1880","webhookPath":"/hubitat/webhook_upstairs","autoRefresh":true,"useWebsocket":false},{"id":"7e71de96.77727","type":"subflow","name":"DevGrpEvent","info":"","category":"","in":[{"x":60,"y":120,"wires":[{"id":"2feace6b.d14dc2"}]}],"out":[{"x":1740,"y":240,"wires":[{"id":"db3390b.b70b57","port":0},{"id":"ee37dbfb.f47708","port":0},{"id":"497e1185.1ce5b","port":0}]},{"x":1740,"y":340,"wires":[{"id":"26ad91b7.ae866e","port":0}]}],"env":[{"name":"TOPIC","type":"str","value":"swGroupName"},{"name":"DEVICES","type":"str","value":""},{"name":"TYPE","type":"str","value":"switch"},{"name":"ACTIONS","type":"str","value":"on/off"},{"name":"ALL_ACTION1","type":"bool","value":"true"},{"name":"ALL_ACTION2","type":"bool","value":"true"},{"name":"SEND_EVENTS","type":"bool","value":"true"},{"name":"RETURN_ALL_MSGS","type":"bool","value":"false"}],"color":"#FC7A5E","outputLabels":["Event Result","Event Status"],"icon":"node-red-contrib-hubitat/device.svg","status":{"x":1740,"y":400,"wires":[{"id":"26ad91b7.ae866e","port":0}]}},{"id":"778ec673.85ac28","type":"function","z":"7e71de96.77727","name":"Gen related device msgs","func":"// walk thru device list and set commands\nvar topic = env.get(\"TOPIC\");\nvar devList = env.get(\"DEVICES\");\nvar activeVal = ( msg.payload.value ? msg.payload.value : \"\" );\n//var devices = devList.split(\",\");\n\n//node.warn(devList);\n\n// devices = env.get(\"DEVICES\").split(\",\");\nvar devices;\nvar isString;\nif (typeof devList === \"string\") {\n    isString = true;\n    devices = devList.split(\",\");\n} else {\n    isString = false;\n    devices = devList;\n}\n\n\n//node.warn(devices);\n\nvar len = devices.length;\n\nflow.set(\"State_MAX\", len);\n\nvar icnt = 0;\ndevices.forEach( o => {\n\n    //var dev = o.split(\"/\");\n    //var hub = dev[0];\n    //var device = dev[1];\n    var hub;\n    var devId;\n    var key;\n\n    if( isString ) { \n        var dev = o.split(\"/\");\n        hub = dev[0];\n        devId = dev[1];\n        key = o;\n    } else {\n        hub = o.hub;\n        devId = o.deviceId;\n        key = o.hub + \"/\" + o.deviceId;\n    }\n\n    //var hub = dev.hub;\n    //var devId = dev.deviceId;\n\n        \n    var path = \"/devices/\" + devId;\n    var parts = {\n        \"id\":topic,\n        \"index\": icnt,\n        \"count\": len,\n        \"type\":\"object\",\n        \"ch\":\"\",\n        \"key\": key,\n        \"len\":\"\"\n    }\n    \n    icnt++;\n    msg.topic = topic;\n    msg.path = path;\n    msg.parts = parts;\n    msg.hub = hub\n    msg.activevalue = activeVal;\n    \n    node.send(msg);\n    node.done();\n}\n);\n\n\n\nreturn;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":930,"y":120,"wires":[["1c902085.1cf74f"]]},{"id":"c9807839.b005f8","type":"join","z":"7e71de96.77727","name":"","mode":"auto","build":"string","property":"payload","propertyType":"msg","key":"topic","joiner":"\\n","joinerType":"str","accumulate":false,"timeout":"","count":"","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":1210,"y":180,"wires":[["392ba79a.a06c58"]]},{"id":"81abc8d5.998a58","type":"change","z":"7e71de96.77727","name":"Initialize flow vars","rules":[{"t":"set","p":"State_1","pt":"flow","to":"0","tot":"jsonata"},{"t":"set","p":"State_2","pt":"flow","to":"0","tot":"jsonata"},{"t":"set","p":"State_MAX","pt":"flow","to":"0","tot":"jsonata"},{"t":"set","p":"devCheck","pt":"flow","to":"[]","tot":"json"},{"t":"set","p":"LstState_1","pt":"flow","to":"","tot":"str"},{"t":"set","p":"LstState_2","pt":"flow","to":"","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":650,"y":120,"wires":[["778ec673.85ac28"]]},{"id":"392ba79a.a06c58","type":"change","z":"7e71de96.77727","name":"","rules":[{"t":"set","p":"state.State_1","pt":"msg","to":"State_1","tot":"flow"},{"t":"set","p":"state.State_2","pt":"msg","to":"State_2","tot":"flow"},{"t":"set","p":"state.State_MAX","pt":"msg","to":"State_MAX","tot":"flow"},{"t":"set","p":"state.State1_devices","pt":"msg","to":"LstState_1","tot":"flow"},{"t":"set","p":"state.State2_devices","pt":"msg","to":"LstState_2","tot":"flow"}],"action":"","property":"","from":"","to":"","reg":false,"x":360,"y":240,"wires":[["e0050d3.909bbf"]]},{"id":"b6398b5.f1c4978","type":"function","z":"7e71de96.77727","name":"accumulate stats","func":"\nvar state1 = flow.get(\"State_1\");\nvar state2 = flow.get(\"State_2\");\nvar devType = env.get(\"TYPE\");\nvar actions = env.get(\"ACTIONS\").split(\"/\");\nvar devices = env.get(\"DEVICES\");\n\n//var retMsg;\nvar hub = msg.hub;\nvar devId = hub + \"/\" + msg.payload.id;\n\n/*\nvar dev = flow.get(\"devs4stats\");\nvar devList = [];\n\nif (dev !== undefined ) {\n    devList = dev;\n}\n*/\n\n//if (!devList) {\n//    node.warn(\"No devices found for \" + hub);\n//    return\n//}\n\n//node.warn(devList);\n\n//node.warn(devList);\nvar devList = flow.get(\"devCheck\") ? flow.get(\"devCheck\") : [];\n\n\n// Note: these only show devices with the same action either State1 or State2 not both.\nvar devLstState1 = flow.get(\"LstState_1\") ? flow.get(\"LstState_1\") : \"\";\nvar devLstState2 = flow.get(\"LstState_2\") ? flow.get(\"LstState_2\") : \"\";\n\nif (!devList.includes(devId)) {\n    \n    //node.warn(devId);\n    \n    devList.push(devId);\n    //dev.devList = devList;\n    flow.set(\"devCheck\",devList);\n    \n    // set flow counting vars\n    var attr = msg.payload.attributes;\n    //node.warn(attr);\n    var osw = attr.find(od => od.name === devType );\n    msg.payload.value = osw.currentValue;\n    \n    var pos;\n    \n    if (osw.currentValue === actions[0]) {\n        state1++;\n        flow.set(\"State_1\",state1);\n\n        if (!devLstState1.includes(devId)){\n            devLstState1 += ( devLstState1 ? \",\" : \"\" ) + devId;\n        }\n        \n        pos = devLstState2.indexOf(devId)\n        if (pos > -1){\n            devLstState2 = devLstState2.replace( ( pos === 0 ? \"\" : \",\") + devId + ( pos === 0 ? \",\" : \"\"), \"\");\n        }\n        //devLstState2 = \"\";\n        \n    } else if (osw.currentValue === actions[1]) {\n        state2++;\n        flow.set(\"State_2\",state2);\n\n        if (!devLstState2.includes(devId)){\n            devLstState2 += ( devLstState2 ? \",\" : \"\" ) + devId;\n        }\n        pos = devLstState1.indexOf(devId)\n        if (pos > -1){\n            devLstState1 = devLstState1.replace( ( pos === 0 ? \"\" : \",\") + devId  + ( pos === 0 ? \",\" : \"\"), \"\");\n        }\n\n    }\n\n    flow.set(\"LstState_1\",devLstState1);\n    flow.set(\"LstState_2\",devLstState2);\n\n    \n    //node.warn(msg)\n    \n    // strip \"path\"/\"hub\" for tidiness\n    delete msg.path;\n    delete msg.hub;\n    \n    //retMsg = msg;\n    node.send(msg);\n    node.done();\n}\n\n\nreturn;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":910,"y":180,"wires":[["c9807839.b005f8"]]},{"id":"e0050d3.909bbf","type":"function","z":"7e71de96.77727","name":"Set payload","func":"var topic = env.get(\"TOPIC\");\nvar devices = env.get(\"DEVICES\");\nvar bAll1 = env.get(\"ALL_ACTION1\");\nvar bAll2 = env.get(\"ALL_ACTION2\");\nvar devType = env.get(\"TYPE\");\nvar actions = env.get(\"ACTIONS\").split(\"/\");\n\nvar cnt1 = msg.state.State_1;\nvar cnt2 = msg.state.State_2;\nvar cntNum = cnt1 + cnt2;\n//var cntNum = msg.state.State_MAX;\nvar calcVal = \"\";\n\nvar newPayld = {\n    \"name\": topic,\n    \"currentValue\": \"\",\n    \"value\": \"\",\n    \"displayName\": topic,\n    \"dataType\": \"ENUM\",\t\n    \"values\": {\"0\":actions[0],\"1\":actions[1]},\n    \"deviceId\": devices\n};\n\nif ( bAll1 && bAll2 ){\n    if (cnt1 === cntNum){\n        calcVal = actions[0];\n    } else if (cnt2 === cntNum){\n        calcVal = actions[1];\n    } else {\n        calcVal = \"pending\";\n    }\n}\nelse if ( bAll1 && !bAll2 ){\n    if (cnt1 === cntNum){\n        calcVal = actions[0];\n    } else {\n        calcVal = actions[1];\n    }\n    \n}\nelse if ( !bAll1 && bAll2 ){\n    if (cnt2 === cntNum){\n        calcVal = actions[1];\n    } else {\n        calcVal = actions[0];\n    }\n}\nelse{\n    calcVal = \"undefined\";\n}\n\nnewPayld.value = calcVal\nnewPayld.currentValue = calcVal\n\nmsg.topic = topic\nmsg.payload = newPayld\n\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":630,"y":240,"wires":[["ee37dbfb.f47708","26ad91b7.ae866e"]]},{"id":"e82be6d9.b86718","type":"switch","z":"7e71de96.77727","name":"SEND_EVENTS = true?","property":"SEND_EVENTS","propertyType":"env","rules":[{"t":"true"}],"checkall":"true","repair":false,"outputs":1,"x":390,"y":60,"wires":[["bc8384ad.287788"]]},{"id":"db3390b.b70b57","type":"rbe","z":"7e71de96.77727","name":"","func":"rbe","gap":"","start":"","inout":"out","property":"payload.value","x":1550,"y":320,"wires":[[]]},{"id":"26ad91b7.ae866e","type":"function","z":"7e71de96.77727","name":"set status payload","func":"/*\n\n{\n\"fill\": (payload.value = \"on\" ? \"green\" : (payload.value = \"off\" ? \"blue\" : \"black\")),\n\"shape\":\"dot\",\n\"text\":'Status: \"' & payload.value & '\"'\n}\n\n*/\n\n\nvar devType = env.get(\"TYPE\");\nvar actions = env.get(\"ACTIONS\").split(\"/\");\n\nvar payload = {\n\"fill\": (msg.payload.value === actions[0] ? \"green\" : (msg.payload.value === actions[1] ? \"blue\" : \"black\")),\n\"shape\":\"dot\",\n\"text\":'Status: \"' + msg.payload.value + '\"'\n};\n\nmsg.payload = payload;\n\n\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":910,"y":360,"wires":[[]]},{"id":"ee37dbfb.f47708","type":"switch","z":"7e71de96.77727","name":"actiontype = passthrough/event","property":"actiontype","propertyType":"msg","rules":[{"t":"eq","v":"passthrough","vt":"str"},{"t":"eq","v":"event","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":950,"y":240,"wires":[[],["7aa39d92.51b7d4"]]},{"id":"2feace6b.d14dc2","type":"change","z":"7e71de96.77727","name":"override = true","rules":[{"t":"set","p":"override","pt":"flow","to":"true","tot":"bool"},{"t":"set","p":"actiontype","pt":"msg","to":"passthrough","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":360,"y":120,"wires":[["81abc8d5.998a58"]]},{"id":"bc8384ad.287788","type":"change","z":"7e71de96.77727","name":"override = false","rules":[{"t":"set","p":"override","pt":"flow","to":"false","tot":"bool"},{"t":"set","p":"actiontype","pt":"msg","to":"event","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":640,"y":60,"wires":[["bbe4a1b7.76f8e"]]},{"id":"ff11f9ac.a1dc08","type":"subflow:52da5ceb.f5efa4","z":"7e71de96.77727","name":"","env":[],"x":120,"y":60,"wires":[["e82be6d9.b86718"]]},{"id":"836e4fce.3b2e","type":"subflow:9e28a145.80b4c","z":"7e71de96.77727","name":"","env":[],"x":640,"y":180,"wires":[["b6398b5.f1c4978"]]},{"id":"bbe4a1b7.76f8e","type":"function","z":"7e71de96.77727","name":"does event match specified deviceId?","func":"// walk thru device list and set commands\nvar topic = env.get(\"TOPIC\");\nvar devList = env.get(\"DEVICES\");\nvar isString;\nvar device;\nvar retMsg;\n\n//node.warn(\"Checking...\");\n//node.warn(devList);\n\nif (typeof devList === \"string\") {\n    device = msg.hub + \"/\" + msg.payload.deviceId;\n    if ( devList.includes(device)) {\n        retMsg = msg;\n        //node.warn(\"String ID = \" + device);\n    }\n    \n} else {\n    if (devList.find( device => { return device.hub === msg.hub && device.deviceId === msg.payload.deviceId })) {\n        //node.warn(\"Found match in JSON object.\");\n        retMsg = msg;    \n    } else {\n        //node.warn(\"Not Found!.\");\n        //node.warn(devList);\n        //node.warn(msg.payload);\n    }\n}\n\nreturn retMsg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":970,"y":60,"wires":[["81abc8d5.998a58"]]},{"id":"f352de63.ef662","type":"inject","z":"7e71de96.77727","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":true,"onceDelay":0.1,"topic":"","payload":"true","payloadType":"bool","x":90,"y":180,"wires":[["adc8b319.affa5"]]},{"id":"fb041b21.135ec8","type":"no-op","z":"7e71de96.77727","name":"","x":1430,"y":120,"wires":[["836e4fce.3b2e"]]},{"id":"1c902085.1cf74f","type":"delay","z":"7e71de96.77727","name":"","pauseType":"delay","timeout":"50","timeoutUnits":"milliseconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"50","randomLast":"100","randomUnits":"milliseconds","drop":false,"x":1230,"y":120,"wires":[["fb041b21.135ec8"]]},{"id":"adc8b319.affa5","type":"change","z":"7e71de96.77727","name":"override = init","rules":[{"t":"set","p":"override","pt":"flow","to":"false","tot":"bool"},{"t":"set","p":"actiontype","pt":"msg","to":"init","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":360,"y":180,"wires":[["81abc8d5.998a58"]]},{"id":"7aa39d92.51b7d4","type":"switch","z":"7e71de96.77727","name":"Return All Msgs?","property":"RETURN_ALL_MSGS","propertyType":"env","rules":[{"t":"true"},{"t":"false"}],"checkall":"true","repair":false,"outputs":2,"x":910,"y":300,"wires":[["497e1185.1ce5b"],["78629b73.6f3d74"]]},{"id":"78629b73.6f3d74","type":"switch","z":"7e71de96.77727","name":"value != pending and != undefined","property":"true","propertyType":"jsonata","rules":[{"t":"eq","v":"payload.value != \"pending\" and payload.value != \"undefined\"","vt":"jsonata"}],"checkall":"true","repair":false,"outputs":1,"x":1320,"y":320,"wires":[["db3390b.b70b57"]]},{"id":"497e1185.1ce5b","type":"change","z":"7e71de96.77727","name":"set payload.value to activevalue","rules":[{"t":"set","p":"payload.value","pt":"msg","to":"activevalue","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":1310,"y":280,"wires":[[]]},{"id":"29102dd4.c88fb2","type":"debug","z":"af91369d.586338","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":670,"y":320,"wires":[]},{"id":"9b30373e.7864f8","type":"inject","z":"af91369d.586338","name":"On","props":[{"p":"command","v":"on","vt":"str"},{"p":"deviceId","v":"[{\"hub\":\"OLDZIGB\",\"deviceId\":\"1773\",\"desc\":\"Office Left Light\"},{\"hub\":\"OLDZIGB\",\"deviceId\":\"1774\",\"desc\":\"Office Right Light\"}]","vt":"json"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payloadType":"str","x":110,"y":300,"wires":[["f1c84278.5de4b"]]},{"id":"33147b0b.f47114","type":"inject","z":"af91369d.586338","name":"Off","props":[{"p":"command","v":"off","vt":"str"},{"p":"deviceId","v":"[ \t{ \t\t\"hub\":\"OLDZIGB\", \t\t\"deviceId\":\"1773\", \t\t\"desc\":\"Office Left Light\" \t}, \t\t{ \t\t\"hub\":\"OLDZIGB\", \t\t\"deviceId\":\"1774\", \t\t\"desc\":\"Office Right Light\" \t} ]","vt":"json"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":110,"y":340,"wires":[["f1c84278.5de4b"]]},{"id":"520a03bd.66998c","type":"debug","z":"af91369d.586338","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":670,"y":260,"wires":[]},{"id":"220cdb4f.808114","type":"subflow:7e71de96.77727","z":"af91369d.586338","name":"","env":[{"name":"TOPIC","value":"OfficeLights","type":"str"},{"name":"DEVICES","value":"OLDZIGB/1773,OLDZIGB/1774","type":"str"},{"name":"SEND_EVENTS","value":"false","type":"bool"}],"x":380,"y":260,"wires":[["520a03bd.66998c"],[]]},{"id":"f1c84278.5de4b","type":"subflow:5f0d4ee4.54595","z":"af91369d.586338","name":"","env":[{"name":"TOPIC","value":"OfficeLights","type":"str"}],"x":390,"y":320,"wires":[["29102dd4.c88fb2"]]},{"id":"70412c3c.829824","type":"debug","z":"af91369d.586338","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":670,"y":380,"wires":[]},{"id":"dff81a81.d917c8","type":"subflow:7e71de96.77727","z":"af91369d.586338","name":"","env":[{"name":"TOPIC","value":"OfficeLights","type":"str"},{"name":"DEVICES","value":"[{\"hub\":\"OLDZIGB\",\"deviceId\":\"1773\",\"desc\":\"Office Left Light\"},{\"hub\":\"OLDZIGB\",\"deviceId\":\"1774\",\"desc\":\"Office Right Light\"}]","type":"json"},{"name":"ALL_ACTION1","value":"false","type":"bool"}],"x":380,"y":380,"wires":[["70412c3c.829824"],[]]},{"id":"2d55ccab.9fa964","type":"inject","z":"af91369d.586338","name":"nothing","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"nothing","payloadType":"str","x":110,"y":260,"wires":[["220cdb4f.808114"]]},{"id":"e3571bb5.35b4c8","type":"comment","z":"af91369d.586338","name":"Group Tests","info":"","x":120,"y":220,"wires":[]}]
3 Likes

Don't feel like the Lone Ranger.

1 Like

It's all I got these days!
:gun: :cowboy_hat_face: :horse:

1 Like

I'm trying to do something that should be fairly simple. I want a plug to turn on at a certain time and then turn off sometime later.

I don't understand the configuration of the on off switch and probably the big timer. The top output is set to 1 and the bottom to 0.

Thanks

Without seeing the configuration of your nodes it's very hard to know what is wrong. If you'll post the the export of the flow I'll be happy to fix it up and send it back. You can PM it to me if you don't wish to make it public.

1 Like

I would really appreciate the help. I'll send it to you in a minute.

1 Like

It seems likely that your bigtimer node is configured incorrectly. You should not be connecting both the top and bottom outputs to the switch node.

Here's the node help for the bigtimer node that explains the output:

Untitled

So if you use the top output then your switch node should be configured to evaluate msg.payload for ON or OFF.

Here is an example of a simple bigtimer configuration to turn a switch on or off at the designated times with the exported sequence:

Untitled

`

Sequence

[{"id":"757969e2.83a418","type":"bigtimer","z":"3943b86.98c64c8","outtopic":"","outpayload1":"","outpayload2":"","name":"Big Timer","comment":"On at 11:15, off at 11:30","lat":0,"lon":0,"starttime":"675","endtime":"690","starttime2":0,"endtime2":0,"startoff":0,"endoff":0,"startoff2":0,"endoff2":0,"offs":0,"outtext1":"","outtext2":"","timeout":1440,"sun":true,"mon":true,"tue":true,"wed":true,"thu":true,"fri":true,"sat":true,"jan":true,"feb":true,"mar":true,"apr":true,"may":true,"jun":true,"jul":true,"aug":true,"sep":true,"oct":true,"nov":true,"dec":true,"day1":0,"month1":0,"day2":0,"month2":0,"day3":0,"month3":0,"day4":0,"month4":0,"day5":0,"month5":0,"day6":0,"month6":0,"day7":0,"month7":0,"day8":0,"month8":0,"day9":0,"month9":0,"day10":0,"month10":0,"day11":0,"month11":0,"day12":0,"month12":0,"d1":0,"w1":0,"d2":0,"w2":0,"d3":0,"w3":0,"d4":0,"w4":0,"d5":0,"w5":0,"d6":0,"w6":0,"xday1":0,"xmonth1":0,"xday2":0,"xmonth2":0,"xday3":0,"xmonth3":0,"xday4":0,"xmonth4":0,"xday5":0,"xmonth5":0,"xday6":0,"xmonth6":0,"xd1":0,"xw1":0,"xd2":0,"xw2":0,"xd3":0,"xw3":0,"xd4":0,"xw4":0,"xd5":0,"xw5":0,"xd6":0,"xw6":0,"suspend":false,"random":false,"randon1":false,"randoff1":false,"randon2":false,"randoff2":false,"repeat":false,"atstart":true,"odd":false,"even":false,"x":920,"y":520,"wires":[["5d03d5d6.e1381c"],[],[]]},{"id":"5d03d5d6.e1381c","type":"switch","z":"3943b86.98c64c8","name":"ON/OFF","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"ON","vt":"str"},{"t":"eq","v":"OFF","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":1080,"y":520,"wires":[["c00cd02f.90f0f"],["ed32bc5.7bf694"]]},{"id":"c00cd02f.90f0f","type":"change","z":"3943b86.98c64c8","name":"msg.command = on","rules":[{"t":"set","p":"command","pt":"msg","to":"on","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1280,"y":500,"wires":[["751858a6.0eba08"]]},{"id":"ed32bc5.7bf694","type":"change","z":"3943b86.98c64c8","name":"msg.command = off","rules":[{"t":"set","p":"command","pt":"msg","to":"off","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1280,"y":540,"wires":[["751858a6.0eba08"]]},{"id":"751858a6.0eba08","type":"hubitat command","z":"3943b86.98c64c8","name":"Fireplace outlet on/off","server":"662851c4.3ccad","deviceId":"33","command":"","commandArgs":"","x":1520,"y":520,"wires":[[]]},{"id":"662851c4.3ccad","type":"hubitat config","name":"HubitatS","usetls":false,"host":"192.168.1.36","port":"80","appId":"4489","nodeRedServer":"http://192.168.1.4:1880","webhookPath":"/hubitat/webhook2","autoRefresh":true,"useWebsocket":false}]

`

1 Like

The odd thing is that my test of BigTimer showed nothing coming from the top output. I simply put debug nodes on the top and bottom and saw the 1 and subsequent 0 from the bottom so I used that in the flow I sent back.

I haven't used BigTimer in any of my flows so I probably mis-configured it. I'll look at what you posted and see if I can get it right.

1 Like

I just use inject nodes for this,

I think the big problem is the profanity in the name of your Debug Node. The Node Red gods are offended. :grinning: :grinning:

Seriously though, one thing to take a look at is your Outdoor Plug Device Node has Send Events box checked. It won't make much difference here since you only have a Debug Node after. Are you getting 2 debug messages for every time plug turns on/off?

Typically you only want Send Events box checked if Device Node is at start of Sequence. When the Send Events box is unchecked, the blue box underneath node will have a white center.

1 Like

Thanks for all the input, I do appreciate it.

The only thing I did with your flow was change the times on BigTimer and I'm not seeing anything on the top output. ???

flow

[{"id":"d2d94d7b.129418","type":"tab","label":"Holiday Lights","disabled":false,"info":""},{"id":"757969e2.83a418","type":"bigtimer","z":"d2d94d7b.129418","outtopic":"","outpayload1":"","outpayload2":"","name":"Big Timer","comment":"On at 11:15, off at 11:30","lat":0,"lon":0,"starttime":"660","endtime":"675","starttime2":0,"endtime2":0,"startoff":"0","endoff":"0","startoff2":0,"endoff2":0,"offs":0,"outtext1":"","outtext2":"","timeout":1440,"sun":true,"mon":true,"tue":true,"wed":true,"thu":true,"fri":true,"sat":true,"jan":true,"feb":true,"mar":true,"apr":true,"may":true,"jun":true,"jul":true,"aug":true,"sep":true,"oct":true,"nov":true,"dec":true,"day1":0,"month1":0,"day2":0,"month2":0,"day3":0,"month3":0,"day4":0,"month4":0,"day5":0,"month5":0,"day6":0,"month6":0,"day7":0,"month7":0,"day8":0,"month8":0,"day9":0,"month9":0,"day10":0,"month10":0,"day11":0,"month11":0,"day12":0,"month12":0,"d1":0,"w1":0,"d2":0,"w2":0,"d3":0,"w3":0,"d4":0,"w4":0,"d5":0,"w5":0,"d6":0,"w6":0,"xday1":0,"xmonth1":0,"xday2":0,"xmonth2":0,"xday3":0,"xmonth3":0,"xday4":0,"xmonth4":0,"xday5":0,"xmonth5":0,"xday6":0,"xmonth6":0,"xd1":0,"xw1":0,"xd2":0,"xw2":0,"xd3":0,"xw3":0,"xd4":0,"xw4":0,"xd5":0,"xw5":0,"xd6":0,"xw6":0,"suspend":false,"random":false,"randon1":false,"randoff1":false,"randon2":false,"randoff2":false,"repeat":false,"atstart":true,"odd":false,"even":false,"x":120,"y":550,"wires":[["37e807cb.3eb518"],[],["c889609e.33945"]]},{"id":"c889609e.33945","type":"debug","z":"d2d94d7b.129418","name":"Bottom","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":280,"y":570,"wires":[]},{"id":"37e807cb.3eb518","type":"debug","z":"d2d94d7b.129418","name":"Top","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":270,"y":530,"wires":[]}]

1 Like

It's working here like you sent back. And your solution helped with a smart switch I was having trouble with. It's a zigbee that doesn't refresh very fast -- that seems strange. Anyway, once I had a working connection to it, I could trouble shoot from there.

1 Like

Humor me, would ya? I'm starting to think there is something wrong with my BigTimer, though it's up-to-date. Would you put a debug node on the top output and see if is sends anything? I got nothin'.

For Pete's sake! I must be overlooking some silly little thing here. I have this flow:
Screenshot_2020-11-21_13-40-30
Simple, right?

I have this BT config:


Simple, right?

I get this for output:
Screenshot_2020-11-21_13-43-51
Crazy, right?

Somebody, please put me out of my misery! Why is there nothing coming out of the first output?

EDIT: I have re-installed the BT node and even rebooted the server NR runs on.