Node-Red Flow Samples/Sharing

Leave the MQTT topic blank. But add the desired text to the MQTT ON msg and OFF msg (don't leave those boxes blank - that's the error I made in my hastily done post). I usually use the text ON and OFF respectively.

Because the first output is reserved for the MQTT output message. It's in those two MQTT message boxes that I usually put ON and OFF.

Edit - Like I said, my bad! I was in a rush and the sequence I posted has a misconfigured bigtimer node. Was hoping to get my C-7 migration done, but in the end, didn't do it because it was nice day and I did some yard work instead.

WHAT??? FFS!!! Nowhere does the sidebar doc say MQTT!

The first output sends out a message at your set ON or OFF times

It is in the web page although it is not at all clear (to me).

BigTimer has 3 outputs, the first of which triggers when there is a change of state and presents one of two messages (for, for example, MQTT or other control mechanism)

But you are correct and here is what I have now:

And the output is as you say:

Screenshot_2020-11-21_15-26-42

So, mystery solved but, IMO, this is on the dev for not being clear.

Thanks, @aaiyar!

2 Likes

will do. I was watching a movie with the wife

I assume you're replying to me and there's no longer a need. See my previous post :point_up:

1 Like

Title - Elgato Key Light control

Summary - This flow links the Elgato Key Light and Elgato Key Light Air to Hubitat, enabling me to control my lights via Alexa, Apple Homekit, and a button controller under my desk. Bliss!

Setup:

  1. On your router / DHCP server: create a static IP address for your Elgato light
  2. In Hubitat: create a Virtual Color Temperature Light, accessible via Maker API
  3. In Node-RED:
    a) Set the Elgato light's IP address in the "set IP address" and "poll device's API every 5s" nodes
    b) Select the virtual light in the two green Hubitat nodes

Advanced users: You can also control the Elgato light from your own flows by sending commands to this flow's link node. The link is lower latency that sending commands via a Hubitat node.

Picture

**Flow**

This flow requires the node-red-contrib-simple-gate and no-op nodes. You can install both of these directly from within Node-RED by visiting the 'Manage Palette' menu.

[{"id":"53317764.a2d868","type":"inject","z":"b09ee1db.07242","name":"poll device's API every 5s","props":[{"p":"IP_address","v":"192.168.0.9","vt":"str"}],"repeat":"5","crontab":"","once":true,"onceDelay":"2","topic":"","payloadType":"str","x":200,"y":340,"wires":[["470bef3e.2003f"]]},{"id":"8baa3909.667a28","type":"change","z":"b09ee1db.07242","name":"set IP address","rules":[{"t":"set","p":"IP_address","pt":"msg","to":"192.168.0.9","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1580,"y":160,"wires":[["bd2b535f.5699b"]]},{"id":"d0b2d0da.8428","type":"comment","z":"b09ee1db.07242","name":"Left Light","info":"","x":80,"y":60,"wires":[]},{"id":"4b4ef25f.a9357c","type":"inject","z":"b09ee1db.07242","name":"Initialize","props":[{"p":"payload"}],"repeat":"","crontab":"","once":true,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":140,"y":140,"wires":[["4a706ebb.a6e76"]]},{"id":"b7add235.f359","type":"hubitat command","z":"b09ee1db.07242","deviceLabel":"Left VC","name":"","server":"f0222da5.5a5e7","deviceId":"2385","command":"","commandArgs":"","x":1800,"y":340,"wires":[[]]},{"id":"4a706ebb.a6e76","type":"hubitat device","z":"b09ee1db.07242","deviceLabel":"Left VC","name":"","server":"f0222da5.5a5e7","deviceId":"2385","attribute":"","sendEvent":true,"x":280,"y":140,"wires":[["d610c795.73d208"]]},{"id":"470bef3e.2003f","type":"http request","z":"b09ee1db.07242","name":"","method":"GET","ret":"txt","paytoqs":"ignore","url":"http://{{IP_address}}:9123/elgato/lights","tls":"","persist":false,"proxy":"","authType":"","x":430,"y":340,"wires":[["cbadbe1d.2978c"]]},{"id":"bd2b535f.5699b","type":"http request","z":"b09ee1db.07242","name":"Send to Elgato light","method":"PUT","ret":"txt","paytoqs":"ignore","url":"http://{{IP_address}}:9123/elgato/lights","tls":"","persist":false,"proxy":"","authType":"","x":1770,"y":160,"wires":[[]]},{"id":"38162faa.2ed8b","type":"json","z":"b09ee1db.07242","name":"","property":"payload","action":"","pretty":false,"x":1430,"y":160,"wires":[["8baa3909.667a28"]]},{"id":"696ff7d9.3c2378","type":"switch","z":"b09ee1db.07242","name":"Which attribute changed?","property":"payload.name","propertyType":"msg","rules":[{"t":"eq","v":"switch","vt":"str"},{"t":"eq","v":"colorTemperature","vt":"str"},{"t":"eq","v":"level","vt":"str"}],"checkall":"false","repair":false,"outputs":3,"x":630,"y":140,"wires":[["718f005f.58adb"],["90a1f46f.7a8858"],["ce4bc53e.962008"]]},{"id":"ce4bc53e.962008","type":"change","z":"b09ee1db.07242","name":"level","rules":[{"t":"set","p":"level","pt":"msg","to":"payload.value","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":850,"y":200,"wires":[["172444c9.311cdb"]]},{"id":"90a1f46f.7a8858","type":"change","z":"b09ee1db.07242","name":"temperature","rules":[{"t":"set","p":"colorTemperature","pt":"msg","to":"$round(1000000 / \t    payload.value,\t    0)","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":870,"y":160,"wires":[["8fd07e5c.1ccaf"]]},{"id":"718f005f.58adb","type":"switch","z":"b09ee1db.07242","name":"on/off","property":"payload.value","propertyType":"msg","rules":[{"t":"eq","v":"on","vt":"str"},{"t":"eq","v":"off","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":850,"y":120,"wires":[["b4852859.2e3838"],["5ed64180.92b54"]]},{"id":"5ed64180.92b54","type":"change","z":"b09ee1db.07242","name":"off","rules":[{"t":"set","p":"on_state","pt":"msg","to":"0","tot":"num"}],"action":"","property":"","from":"","to":"","reg":false,"x":1010,"y":140,"wires":[["fcd023a7.161a5"]]},{"id":"fcd023a7.161a5","type":"change","z":"b09ee1db.07242","name":"Elgato on/off","rules":[{"t":"delete","p":"payload","pt":"msg"},{"t":"set","p":"payload.numberOfLights","pt":"msg","to":"1","tot":"num"},{"t":"set","p":"payload.lights[0].on","pt":"msg","to":"on_state","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":1170,"y":120,"wires":[["38162faa.2ed8b"]]},{"id":"8fd07e5c.1ccaf","type":"change","z":"b09ee1db.07242","name":"Elgato color temperature","rules":[{"t":"delete","p":"payload","pt":"msg"},{"t":"set","p":"payload.numberOfLights","pt":"msg","to":"1","tot":"num"},{"t":"set","p":"payload.lights[0].temperature","pt":"msg","to":"colorTemperature","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":1210,"y":160,"wires":[["38162faa.2ed8b"]]},{"id":"172444c9.311cdb","type":"change","z":"b09ee1db.07242","name":"Elgato brightness (min 2)","rules":[{"t":"delete","p":"payload","pt":"msg"},{"t":"set","p":"payload.numberOfLights","pt":"msg","to":"1","tot":"num"},{"t":"set","p":"payload.lights[0].brightness","pt":"msg","to":"$max([2,msg.level])","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":1210,"y":200,"wires":[["38162faa.2ed8b"]]},{"id":"b4852859.2e3838","type":"change","z":"b09ee1db.07242","name":"on","rules":[{"t":"set","p":"on_state","pt":"msg","to":"1","tot":"num"}],"action":"","property":"","from":"","to":"","reg":false,"x":1010,"y":100,"wires":[["fcd023a7.161a5"]]},{"id":"6b1d1975.5977f8","type":"link in","z":"b09ee1db.07242","name":"command injector for left VC light","links":["74eb1dea.81dfd4"],"x":315,"y":80,"wires":[["d610c795.73d208"]]},{"id":"d610c795.73d208","type":"no-op","z":"b09ee1db.07242","name":"","x":430,"y":140,"wires":[["696ff7d9.3c2378","74b4b7c2.f94bc8"]]},{"id":"b163f868.b841a8","type":"change","z":"b09ee1db.07242","name":"topic = control","rules":[{"t":"set","p":"topic","pt":"msg","to":"control","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1020,"y":260,"wires":[["cbadbe1d.2978c"]]},{"id":"74b4b7c2.f94bc8","type":"trigger","z":"b09ee1db.07242","name":"Pause polling for 5s to prevent race condition","op1":"close","op2":"open","op1type":"str","op2type":"str","duration":"5","extend":false,"overrideDelay":false,"units":"s","reset":"","bytopic":"all","topic":"topic","outputs":1,"x":740,"y":260,"wires":[["b163f868.b841a8"]]},{"id":"cbadbe1d.2978c","type":"gate","z":"b09ee1db.07242","name":"","controlTopic":"control","defaultState":"open","openCmd":"open","closeCmd":"close","toggleCmd":"toggle","defaultCmd":"default","statusCmd":"status","persist":false,"x":910,"y":340,"wires":[["f2ab6827.73a878"]]},{"id":"f6f76a93.e58278","type":"json","z":"b09ee1db.07242","name":"","property":"payload","action":"","pretty":false,"x":1190,"y":340,"wires":[["bcc4e21d.8ad46"]]},{"id":"bc098f02.ea80a","type":"change","z":"b09ee1db.07242","name":"level (min 2)","rules":[{"t":"set","p":"command","pt":"msg","to":"setLevel","tot":"str"},{"t":"set","p":"arguments","pt":"msg","to":"payload.lights[0].brightness","tot":"msg"},{"t":"set","p":"arguments","pt":"msg","to":"$max([2,msg.arguments])","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":1550,"y":320,"wires":[["b7add235.f359"]]},{"id":"e6ef88a.1201978","type":"change","z":"b09ee1db.07242","name":"temperature","rules":[{"t":"set","p":"command","pt":"msg","to":"setColorTemperature","tot":"str"},{"t":"set","p":"arguments","pt":"msg","to":"$round(\t$round(2000000 * \t    $power(payload.lights[0].temperature,-1),\t    -2),\t    0)/2","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":1550,"y":360,"wires":[["b7add235.f359"]]},{"id":"bcc4e21d.8ad46","type":"switch","z":"b09ee1db.07242","name":"on/off","property":"payload.lights[0].on","propertyType":"msg","rules":[{"t":"eq","v":"1","vt":"num"},{"t":"eq","v":"0","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":1330,"y":340,"wires":[["dddbd0df.054a9","bc098f02.ea80a","e6ef88a.1201978"],["f01ab922.1b5bf8"]]},{"id":"dddbd0df.054a9","type":"change","z":"b09ee1db.07242","name":"on","rules":[{"t":"set","p":"command","pt":"msg","to":"on","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1530,"y":280,"wires":[["b7add235.f359"]]},{"id":"f01ab922.1b5bf8","type":"change","z":"b09ee1db.07242","name":"off","rules":[{"t":"set","p":"command","pt":"msg","to":"off","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1530,"y":400,"wires":[["b7add235.f359"]]},{"id":"1102887a.76ec28","type":"comment","z":"b09ee1db.07242","name":"Note on pre-staging","info":"Hubitat's virtual light doesn't support pre-staging, so we don't send color temperature or level messages to Elgato lights when off or else it'll turn on","x":1570,"y":440,"wires":[]},{"id":"f2ab6827.73a878","type":"rbe","z":"b09ee1db.07242","name":"","func":"rbe","gap":"","start":"","inout":"out","property":"payload","x":1050,"y":340,"wires":[["f6f76a93.e58278"]]},{"id":"f0222da5.5a5e7","type":"hubitat config","name":"Hubitat","usetls":false,"host":"192.168.0.2","port":"80","appId":"2781","nodeRedServer":"http://192.168.0.4:1880","webhookPath":"/hubitat/webhook","autoRefresh":true,"useWebsocket":false}]

Title - Bose SoundTouch integration with Node Red

Summary - This flow has been copied, but enhanced from here (This guy is the true genius behind this, not me)

  • 6th Preset Button added, as there were only 5.
  • Web dashboard updated and enhanced
  • Removed Info button function
  • Added music information (Including Track Title, Artist and Album Art
  • Updated CSS

Setting up Groups for multiroom isn't working at the min, it didn't from the original flow either, but working on that. Will update as soon as I can. I'll more than likely make the Track details etc hideable via a button too. But works great on my iPhone anyway :slight_smile:

To add your speakers, edit the "initialize" function and enter your speaker details.
image

flow.set('bose_soundtouch_systems', {"systems": []}, 'memory');
msg.payload = [
{
    "name": "Bose Speaker 1", 
    "ipAddress": "123.456.789.123",
    "macAddress": "123456abcde"
},
{
    "name": "Bose Speaker 2", 
    "ipAddress": "123.456.789.123",
    "macAddress": "123456abcde"
},
];
return msg;

Picture -
Full flow


Dash images

Select the dropdown to chose the speaker to control
image

Your saved presets are on the left

You can set the values of the L, M and H buttons for different volume levels.

Setting up groups for multiroom (Not working currently but work in progress, the original flow didn't work either)

Flow -
Full flow here as it was too big for the post :slight_smile:

Then make sure you submit an issue on their github (if you haven't already) so they consider changing the documentation. Complaining, but not telling the author, is less than useful. :slight_smile:

3 Likes

In BigTimer - Scargill's Tech Blog the author says

The MQTT-compatible payload (ON and OFF msg) is the main output and you should put a value in there even if not using MQTT

There are comments at the bottom of that page as far back as July 3, 2020 at 9:31 am that cite the issue so it's not unknown to the author. He's actually dismissive of it, IMO.

2 Likes

Gotcha. Well, it's his stuff, so his decision. I guess if someone felt strongly enough about it they could fork his/her code and release a different version.

1 Like

I’ve generally switched from using BigTimer to cronplus.

1 Like

I have both and employ cronplus. I hadn't used BigTimer until helping @edhall1044 with his flow Node-Red Flow Samples/Sharing and I don't think I will anytime soon.

1 Like

To his credit, I rewrote the ambiguous parts and he has already pushed the update.

3 Likes

That's cool. Good of you to do that. I always try to give them feedback/suggestions as much as I can. Sometimes they are receptive, sometimes not.

2 Likes

Wondering if I could get some help with a flow. I'm feeling fairly certain this would require a little coding with a function node, but since I'm not a programmer and don't code I don't really know where to start. What I would like to do is have a flow that fires when one of us is at a location (in this case the grocery store), retrieves a list from Alexa, and pushes it to our mobile device(s). I'm using @bptworld's Life360 with States app and I've got that part of the flow sorted out. I'm using the alexa-remote2 and Pushover nodes in NR. The problem is with how the list information is formatted:

`[{"completed":false,"createdDateTime":1605580187860,"customerId":null,"id":"38d09c0e-8c2c-4d11-86a4-eedf75dcf341","listId":"4c575edf-d412-4751-a343-8b63888d5bc5","shoppingListItem":false,"updatedDateTime":1605580187860,"value":"oatmeal","version":1},{"completed":false,"createdDateTime":1605580151939,"customerId":null,"id":"20dbf8d4-d924-4692-85ce-9598ecd25a30","listId":"4c575edf-d412-4751-a343-8b63888d5bc5","shoppingListItem":false,"updatedDateTime":1605580151939,"value":"flour","version":1},{"completed":false,"createdDateTime":1605580142216,"customerId":null,"id":"4ae6fe69-df6f-4487-bfad-8b2625b7a073","listId":"4c575edf-d412-4751-a343-8b63888d5bc5","shoppingListItem":false,"updatedDateTime":1605580142216,"value":"turkey","version":1},{"completed":false,"createdDateTime":1605549086848,"customerId":null,"id":"e364d22e-d30e-42c9-ae63-86bbc42cc2f1","listId":"4c575edf-d412-4751-a343-8b63888d5bc5","shoppingListItem":false,"updatedDateTime":1605549086848,"value":"bread","version":1},{"completed":false,"createdDateTime":1605450913537,"customerId":null,"id":"0a2ccb00-2c41-45e5-b58e-6dddcc39d517","listId":"4c575edf-d412-4751-a343-8b63888d5bc5","shoppingListItem":false,"updatedDateTime":1605450913537,"value":"maple syrup","version":1},{"completed":false,"createdDateTime":1604623366703,"customerId":null,"id":"72a2036e-8bc2-4c63-8dab-79d98b159d55","listId":"4c575edf-d412-4751-a343-8b63888d5bc5","shoppingListItem":false,"updatedDateTime":1604623366703,"value":"thousand dollars","version":1},{"completed":false,"createdDateTime":1604271069031,"customerId":null,"id":"8d77617d-08ee-407e-84e7-5244cfd3f1b6","listId":"4c575edf-d412-4751-a343-8b63888d5bc5","shoppingListItem":false,"updatedDateTime":1604271069031,"value":"lunch meat","version":1},{"completed":false,"createdDateTime":1604269903573,"customerId":null,"id":"dbb191f4-55d2-456b-9105-40e000eb70ff","listId":"4c575edf-d412-4751-a343-8b63888d5bc5","shoppingListItem":false,"updatedDateTime":1604269903573,"value":"onions","version":1},{"completed":false,"createdDateTime":1603722190668,"customerId":null,"id":"3d8daa39-c076-4bae-897f-38e1a7f40143","listId":"4c575edf-d412-4751-a343-8b63888d5bc5","shoppingListItem":false,"updatedDateTime":1603722190668,"value":"onion powder","version":1},{"completed":false,"createdDateTime":1601331690833,"customerId":null,"id":"61e850a0-5d79-49df-8464-f7c3e022bd05","listId":"4c575edf-d412-4751-a343-8b63888d5bc5","shoppingListItem":false,"updatedDateTime":1601331690833,"value":"basil","version":1},{"completed":false,"createdDateTime":1600638029405,"customerId":null,"id":"fc5197f7-220c-4e01-8fbc-3869ac4ac740","listId":"4c575edf-d412-4751-a343-8b63888d5bc5","shoppingListItem":false,"updatedDateTime":1600638029405,"value":"oregano","version":1},{"completed":false,"createdDateTime":1597233072569,"customerId":null,"id":"090b3e43-f619-48f1-9a56-621d356ff749","listId":"4c575edf-d412-4751-a343-8b63888d5bc5","shoppingListItem":false,"updatedDateTime":1597233072569,"value":"creamer","version":1},{"completed":false,"createdDateTime":1597191981133,"customerId":null,"id":"1718efec-e222-4283-aef0-a6bc94dfb227","listId":"4c575edf-d412-4751-a343-8b63888d5bc5","shoppingListItem":false,"updatedDateTime":1597191981133,"value":"ground mustard","version":1},{"completed":false,"createdDateTime":1596666447765,"customerId":null,"id":"3ba1b403-329e-4ef5-80d0-39688344674c","listId":"4c575edf-d412-4751-a343-8b63888d5bc5","shoppingListItem":false,"updatedDateTime":1596666447765,"value":"pizza dough","version":1},{"completed":false,"createdDateTime":1588511145488,"customerId":null,"id":"dd1b3625-7372-4000-9dd2-b43c2e555710","listId":"4c575edf-d412-4751-a343-8b63888d5bc5","shoppingListItem":false,"updatedDateTime":1588511145488,"value":"milk","version":1},{"completed":true,"createdDateTime":1605115641266,"customerId":null,"id":"17de5376-1bab-400f-9ece-92a1adf96d53","listId":"4c575edf-d412-4751-a343-8b63888d5bc5","shoppingListItem":false,"updatedDateTime":1605549096580,"value":"strawberry jelly","version":2},{"completed":true,"createdDateTime":1604623428233,"customerId":null,"id":"1857df65-f794-4af6-a26b-9428b278470e","listId":"4c575edf-d412-4751-a343-8b63888d5bc5","shoppingListItem":false,"updatedDateTime":1605549104607,"value":"thousand island dressing","version":2},{"completed":true,"createdDateTime":1604623227135,"customerId":null,"id":"e9988f85-01ad-4407-a442-f2edce498639","listId":"4c575edf-d412-4751-a343-8b63888d5bc5","shoppingListItem":false,"updatedDateTime":1605549113639,"value":"ranch","version":2},{"completed":true,"createdDateTime":1604271075878,"customerId":null,"id":"5dc94a35-7a6b-43cf-9c18-14eaa7703e89","listId":"4c575edf-d412-4751-a343-8b63888d5bc5","shoppingListItem":false,"updatedDateTime":1604271091480,"value":"sandwich bread","version":2},{"completed":true,"createdDateTime":1604271057936,"customerId":null,"id":"eaf189fd-a0a7-426e-9ffd-5cee44e05fa0","listId":"4c575edf-d412-4751-a343-8b63888d5bc5","shoppingListItem":false,"updatedDateTime":1605549121102,"value":"cooking spray","version":2},{"completed":true,"createdDateTime":1604271048125,"customerId":null,"id":"80567e01-46f7-4bf2-877e-deb25c565cb6","listId":"4c575edf-d412-4751-a343-8b63888d5bc5","shoppingListItem":false,"updatedDateTime":1605549137013,"value":"montreal steak seasoning","version":2},{"completed":true,"createdDateTime":1604271037505,"customerId":null,"id":"d7444d9c-0733-4394-924b-c25b6da42ac3","listId":"4c575edf-d412-4751-a343-8b63888d5bc5","shoppingListItem":false,"updatedDateTime":1605549144137,"value":"chili powder","version":2},{"completed":true,"createdDateTime":1604271025890,"customerId":null,"id":"aa12ad6a-ee80-46d3-b732-8dd2c40ed377","listId":"4c575edf-d412-4751-a343-8b63888d5bc5","shoppingListItem":false,"updatedDateTime":1605549156946,"value":"ketchup","version":2},{"completed":true,"createdDateTime":1604271014694,"customerId":null,"id":"aaa70104-d43a-419b-a616-3ca04defa46e","listId":"4c575edf-d412-4751-a343-8b63888d5bc5","shoppingListItem":false,"updatedDateTime":1605549181130,"value":"garlic","version":2},{"completed":true,"createdDateTime":1601424088639,"customerId":null,"id":"223debcf-b8a5-4db5-a6b9-708de16f45f9","listId":"4c575edf-d412-4751-a343-8b63888d5bc5","shoppingListItem":false,"updatedDateTime":1601900273349,"value":"cat food","version":2},{"completed":true,"createdDateTime":1596989102446,"customerId":null,"id":"cd866bbf-7198-4bef-b58b-8ff028921346","listId":"4c575edf-d412-4751-a343-8b63888d5bc5","shoppingListItem":false,"updatedDateTime":1597191989069,"value":"sesame oil","version":2},{"completed":true,"createdDateTime":1596989093210,"customerId":null,"id":"d51f8d62-20d5-4c80-a4be-e34a92366d99","listId":"4c575edf-d412-4751-a343-8b63888d5bc5","shoppingListItem":false,"updatedDateTime":1597191995266,"value":"honey","version":2},{"completed":true,"createdDateTime":1588511168529,"customerId":null,"id":"6e2de787-f49d-4962-b213-8d016a18cd94","listId":"4c575edf-d412-4751-a343-8b63888d5bc5","shoppingListItem":false,"updatedDateTime":1596989125288,"value":"eggos","version":2},{"completed":true,"createdDateTime":1588511152251,"customerId":null,"id":"640a02fe-dfbc-446d-bab3-b5335cb44d4b","listId":"4c575edf-d412-4751-a343-8b63888d5bc5","shoppingListItem":false,"updatedDateTime":1588513212176,"value":"barbecue sauce","version":2},{"completed":true,"createdDateTime":1588511137158,"customerId":null,"id":"b37420d1-489a-4deb-a949-afbbbb47777b","listId":"4c575edf-d412-4751-a343-8b63888d5bc5","shoppingListItem":false,"updatedDateTime":1588513207143,"value":"brown sugar","version":2},{"completed":true,"createdDateTime":1587683134025,"customerId":null,"id":"8e1fe3d2-517f-4ec2-83a8-6d2e7a46a2d7","listId":"4c575edf-d412-4751-a343-8b63888d5bc5","shoppingListItem":false,"updatedDateTime":1588511160254,"value":"salt","version":2},{"completed":true,"createdDateTime":1587251821871,"customerId":null,"id":"3c05bce3-4da6-4f55-bc24-78f92e651065","listId":"4c575edf-d412-4751-a343-8b63888d5bc5","shoppingListItem":false,"updatedDateTime":1587308506519,"value":"waffles","version":2},{"completed":true,"createdDateTime":1587251810704,"customerId":null,"id":"2226fa8d-3cfa-4718-9fe8-97cccd7331bf","listId":"4c575edf-d412-4751-a343-8b63888d5bc5","shoppingListItem":false,"updatedDateTime":1596989131294,"value":"ham","version":2},{"completed":true,"createdDateTime":1587040668876,"customerId":null,"id":"a9962118-c273-4413-89e7-d914ff4b71bf","listId":"4c575edf-d412-4751-a343-8b63888d5bc5","shoppingListItem":false,"updatedDateTime":1588511175952,"value":"maple syrup","version":2},{"completed":true,"createdDateTime":1587040657621,"customerId":null,"id":"fce616eb-8228-4378-b586-f243195d6aac","listId":"4c575edf-d412-4751-a343-8b63888d5bc5","shoppingListItem":false,"updatedDateTime":1587308517544,"value":"eggos","version":2},{"completed":true,"createdDateTime":1586902931669,"customerId":null,"id":"e614cbd5-7052-42a2-aae0-11585d9a88a0","listId":"4c575edf-d412-4751-a343-8b63888d5bc5","shoppingListItem":false,"updatedDateTime":1587308512145,"value":"paprika","version":2},{"completed":true,"createdDateTime":1586470812036,"customerId":null,"id":"9b30b36c-97cd-4bff-ba92-fa9eb702e57e","listId":"4c575edf-d412-4751-a343-8b63888d5bc5","shoppingListItem":false,"updatedDateTime":1588513216910,"value":"aluminum foil","version":2},{"completed":true,"createdDateTime":1585088030428,"customerId":null,"id":"2995c458-dc36-4484-ad41-a2ca98e21b48","listId":"4c575edf-d412-4751-a343-8b63888d5bc5","shoppingListItem":false,"updatedDateTime":1587308530445,"value":"ground cumin","version":2},{"completed":true,"createdDateTime":1584915346072,"customerId":null,"id":"5e153934-4b35-4c67-a84f-04c79626cbac","listId":"4c575edf-d412-4751-a343-8b63888d5bc5","shoppingListItem":false,"updatedDateTime":1586470835251,"value":"shortening","version":2},{"completed":true,"createdDateTime":1584915338997,"customerId":null,"id":"cd7fcadb-7d5e-4dd5-bf75-e475f38eef94","listId":"4c575edf-d412-4751-a343-8b63888d5bc5","shoppingListItem":false,"updatedDateTime":1586470822733,"value":"chili powder","version":2},{"completed":true,"createdDateTime":1584915331697,"customerId":null,"id":"e94e6934-2ac4-46bb-ad45-bdcb5a9bcbd7","listId":"4c575edf-d412-4751-a343-8b63888d5bc5","shoppingListItem":false,"updatedDateTime":1586470846115,"value":"mayonnaise","version":2},{"completed":true,"createdDateTime":1584915323746,"customerId":null,"id":"73c8e028-e2d5-439c-be7a-d4e9cff4e1cc","listId":"4c575edf-d412-4751-a343-8b63888d5bc5","shoppingListItem":false,"updatedDateTime":1586470851914,"value":"ketchup","version":2},{"completed":true,"createdDateTime":1559249445656,"customerId":null,"id":"32959576-36fb-4473-9094-f596914ead38","listId":"4c575edf-d412-4751-a343-8b63888d5bc5","shoppingListItem":false,"updatedDateTime":1586902947017,"value":"ketchup","version":2},{"completed":true,"createdDateTime":1553276093483,"customerId":null,"id":"26af8ee4-c7ab-436d-a005-ea07d0e229dd","listId":"4c575edf-d412-4751-a343-8b63888d5bc5","shoppingListItem":false,"updatedDateTime":1586470857548,"value":"coffee","version":2},{"completed":true,"createdDateTime":1553276062110,"customerId":null,"id":"346d9f88-291f-43cf-9b0b-8d5da6639c9b","listId":"4c575edf-d412-4751-a343-8b63888d5bc5","shoppingListItem":false,"updatedDateTime":1596989137210,"value":"bread","version":2},{"completed":true,"createdDateTime":1553036910802,"customerId":null,"id":"ea012473-64b1-440d-bba9-8d97e4abbfa7","listId":"4c575edf-d412-4751-a343-8b63888d5bc5","shoppingListItem":false,"updatedDateTime":1553276077664,"value":"toilet paper","version":2},{"completed":true,"createdDateTime":1553025145698,"customerId":null,"id":"563eff10-269a-4932-ab1c-e4da71f5d988","listId":"4c575edf-d412-4751-a343-8b63888d5bc5","shoppingListItem":false,"updatedDateTime":1553027726960,"value":"american cheese","version":2},{"completed":true,"createdDateTime":1553025106149,"customerId":null,"id":"e5d6a3cc-37ec-4a49-94e8-61a0c8902471","listId":"4c575edf-d412-4751-a343-8b63888d5bc5","shoppingListItem":false,"updatedDateTime":1553025112345,"value":"butter","version":2},{"completed":true,"createdDateTime":1553025083182,"customerId":null,"id":"0c84eb45-d06f-46f4-a6dc-7b258a4a4d2c","listId":"4c575edf-d412-4751-a343-8b63888d5bc5","shoppingListItem":false,"updatedDateTime":1553026415238,"value":"red potatoes","version":2},{"completed":true,"createdDateTime":1553025069708,"customerId":null,"id":"5eab44de-c612-422f-a0e9-10e813612690","listId":"4c575edf-d412-4751-a343-8b63888d5bc5","shoppingListItem":false,"updatedDateTime":1553027699654,"value":"creamer","version":2},{"completed":true,"createdDateTime":1553025016160,"customerId":null,"id":"5532783e-f8fc-4b59-962e-c4547c25ee36","listId":"4c575edf-d412-4751-a343-8b63888d5bc5","shoppingListItem":false,"updatedDateTime":1553027161404,"value":"cereal","version":2},{"completed":true,"createdDateTime":1553025001824,"customerId":null,"id":"6bf3be7f-96d1-4796-ae6b-9b815d4d8a10","listId":"4c575edf-d412-4751-a343-8b63888d5bc5","shoppingListItem":false,"updatedDateTime":1553027749997,"value":"ghee","version":2},{"completed":true,"createdDateTime":1553024985896,"customerId":null,"id":"8e716295-a08e-4f10-b290-3a7825e07ee8","listId":"4c575edf-d412-4751-a343-8b63888d5bc5","shoppingListItem":false,"updatedDateTime":1553026544868,"value":"green beans","version":2},{"completed":true,"createdDateTime":1553024897841,"customerId":null,"id":"104724bf-c2ef-42ea-9101-6b1dccb79974","listId":"4c575edf-d412-4751-a343-8b63888d5bc5","shoppingListItem":false,"updatedDateTime":1553026499972,"value":"shallots fresh thyme","version":2},{"completed":true,"createdDateTime":1553024889764,"customerId":null,"id":"0965c4cf-3cf0-4930-8e6a-fb12f6c3f1af","listId":"4c575edf-d412-4751-a343-8b63888d5bc5","shoppingListItem":false,"updatedDateTime":1553026477216,"value":"garlic","version":2},{"completed":true,"createdDateTime":1553024882286,"customerId":null,"id":"6f799077-02cf-4dc9-9c67-4f75344074c7","listId":"4c575edf-d412-4751-a343-8b63888d5bc5","shoppingListItem":false,"updatedDateTime":1553027006602,"value":"filet mignon","version":2},{"completed":true,"createdDateTime":1553024875024,"customerId":null,"id":"1461df4f-2c66-4076-b44d-1576cd23e909","listId":"4c575edf-d412-4751-a343-8b63888d5bc5","shoppingListItem":false,"updatedDateTime":1553026800513,"value":"bread","version":2},{"completed":true,"createdDateTime":1553024868381,"customerId":null,"id":"c237b0e6-de15-42b2-bae8-94015ff80aa7","listId":"4c575edf-d412-4751-a343-8b63888d5bc5","shoppingListItem":false,"updatedDateTime":1553027092269,"value":"juice","version":2},{"completed":true,"createdDateTime":1553024862196,"customerId":null,"id":"5809c83c-d607-4acb-9e3e-2c08456b3595","listId":"4c575edf-d412-4751-a343-8b63888d5bc5","shoppingListItem":false,"updatedDateTime":1553027092748,"value":"milk","version":2},{"completed":true,"createdDateTime":1553024854472,"customerId":null,"id":"74df9193-35d7-4d22-9000-2ad1fcf9982b","listId":"4c575edf-d412-4751-a343-8b63888d5bc5","shoppingListItem":false,"updatedDateTime":1553027651661,"value":"milk","version":2}]`

I would need to filter out the rest of that garbage and need the actual object values formatted out in a list. Is there an 'easy' way to do this? More fun would be to map the Life360 device to the Pushover device and send the notification only to that device that triggered the flow...but I'd be happy with just getting the list formatted right.

I do something similar in a function node (parse values from an array)...

Function Code

var m = msg.payload
var t =""

for(x=0;x<m.length;x++){
t = "INSERT INTO events SET row_id="+m.row_id+", source='"+m.source+"',name =' "+m.name
t=t+ "', displayName='"+m.displayName+"', value='"+m.value+"', unit='"+m.unit+"', deviceId="+m.deviceId
t = t+", hubId="+m.hubId+", locationId="+m.locationId+", installedAppId="+m.installedAppId
t= t+ ", descriptionText='"+m.descriptionText+"', created="
var year=m.created.getFullYear()
var month = m.created.getMonth()+1
var date = m.created.getDate()
var hour = m.created.getHours()
var minute = m.created.getMinutes()
var seconds = m.created.getSeconds()
var sqlDate = year+"-"+month+"-"+date+" "+hour+":"+minute+":"+seconds
t=t+"STR_TO_DATE('"+sqlDate+"','%Y-%m-%d %H:%i:%s')"
node.send({topic:t})
}

The key parts are:

var m = msg.payload - copy the data into a variable (easier to manage)
var t ="" - create a blank text string (this would hold your list)

for(x=0;x<m.length;x++){ - this loops through each record
t = "INSERT INTO events SET row_id="+m[x].row_id+", source='"... - this is where I build the string, In your case, this may look something like below:

t=t+m[x].value+", " - this would take the value element of each record and build a comma separated list...(in your example data, it would look like "oatmeal, "

Hopefully, something like this would work for you...

2 Likes

Yes, there is an easy way to do this. Because I lack @rakeshg's skill in turning out a neat javascript function, I rely on the built-in nodes (in this case split & join). Here's the relevant portion of a sequence that sends me an SMS when I'm at Costco (based on OwnTracks, but Life360 would work the same).

Here's the code:

[{"id":"aa794ad8.0fc3b8","type":"alexa-remote-list","z":"fc863045.38b668","name":"","account":"5b3978bd.f4d4e8","config":{"option":"getListItems","value":{"list":{"type":"str","value":"YW16bjEuYWNjb3VudC5BR0ZaNFA3SEhNM1FTVUZHQlRJVjJXQUtJMlNRLVNIT1BQSU5HX0lURU0="}}},"x":1560,"y":180,"wires":[["71f06923.371c28"]]},{"id":"71f06923.371c28","type":"split","z":"fc863045.38b668","name":"","splt":"\\n","spltType":"str","arraySplt":1,"arraySpltType":"len","stream":false,"addname":"","x":1730,"y":180,"wires":[["b37a8fd4.9ad6c"]]},{"id":"b37a8fd4.9ad6c","type":"change","z":"fc863045.38b668","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.value","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":1900,"y":180,"wires":[["ab9cfd91.58d428"]]},{"id":"ab9cfd91.58d428","type":"join","z":"fc863045.38b668","name":"","mode":"custom","build":"string","property":"payload","propertyType":"msg","key":"topic","joiner":"\\n","joinerType":"str","accumulate":false,"timeout":"","count":"","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":2070,"y":180,"wires":[["f55f05dd.4dec88"]]},{"id":"f55f05dd.4dec88","type":"change","z":"fc863045.38b668","name":"","rules":[{"t":"set","p":"topic","pt":"msg","to":"Costco shopping list","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":2240,"y":180,"wires":[["79eecb90.1d6b44"]]},{"id":"5b3978bd.f4d4e8","type":"alexa-remote-account","name":"Alexa","authMethod":"proxy","proxyOwnIp":"192.168.1.4","proxyPort":"3456","cookieFile":"/home/odroid/.node-red/alexa-save","refreshInterval":"1","alexaServiceHost":"pitangui.amazon.com","amazonPage":"amazon.com","acceptLanguage":"en-US","userAgent":"","useWsMqtt":"on","autoInit":"on"}]

This is what the SMS message looks like:

4 Likes

That did the trick, thanks again!

1 Like

That's pretty cool. If there's ever a local-only TTS/STT device I'll do it.

I'm curious...how do you close the loop and check off just the items you purchased?

1 Like

Good question! I do that when I get home. Which reminds of something else. My actual sequence looks like this, and has a switch node after the split node:

The configuration of the switch node is:

This ensures that items I "check off" in the Alexa app are removed from the text message that is sent.

Edit: Also, I have different Alexa lists for each of the stores that I commonly go to (Costco, grocery store, hardware store).

1 Like