Only slighly off topic... Node-Red - how to build a text string that referenced a msg.payload #6329
Replies: 1 comment
-
Posted at 2020-09-29 by HeneryH_(Henery_Hawk) I'd really like to combine two values, but it seems like each topic is triggered separately. It would be cleaner from the SMS reader's point of view for the message to be:
but it isn't clear to me how to do this graphically in Node-Red. Posted at 2020-09-30 by @gfwilliams Well, in the first instance, I'd drag in a 'function' block and add the following code inside it:
And for the second option, you can use Add a function block to the battery message
Add a function block to the click message:
Hope that helps! Posted at 2020-09-30 by HeneryH_(Henery_Hawk) Awesome! Now I know how to format message payloads. Thank you @gfwilliams , this works perfectly as you suggested. The method for referring to Message-A from Message-B is going to be useful in the future. I also used this formatting function to not only format my lack of motion alerts, but also limit them to waking hours only. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Posted at 2020-09-29 by HeneryH_(Henery_Hawk)
I have my project working fine from an engineer's perspective but I need to tidy it up a bit.
When my Puck.js detects a button press, the Espruino-Hub/Node-Red servers send an SMS using Twilio. In Node-Red it finds the msg-payload value which is the cumulative number of button presses since power cycle.
The problem I am having is my lack of understanding of how to work in Node-Red with messages.
In many programming languages I wand something like
Does anyone know how to do this in Node-Red?
Thanks
Beta Was this translation helpful? Give feedback.
All reactions