I wrote some code in the “function” node, but I need data stored in the “property” of the device. I would like to be able to call “property read” and “property write” inside the “function” node.
Is it possible to call the “property read” and “property write” node inside the “function” node?
For that I use the “property read” and “property write” node.
Maybe what you need is to add a function node to change the keys into the running msg and avoid destroying the payload info from a previous node.
For example, after the “property read” node, all the info from this node is into the msg.payload key, so you can add a function node to store msg.payoad as msg.propertyRead (as example), so the next node if have some payload to return, you wont lose the property read and will have available for use later into other “function” node.
It is not possible to call them directly from the function node, but you can pass a message with your desired values into the property read and write nodes.
I’m adopting a similar strategy using function nodes in parallel with property-read, joined at the end with the join node.
As we don’t have an alert handler in Thinger yet, I’m developing one. But the learning curve with NodeRed is steep, compared to being able to write the code in the same notebook (as we do in the function node).
I hope the next release Alerts Manager will be available, it will help a lot in device management.
I used to do this, then learned how to save the payload with another key by a function node, I prefer do this because you may add as much info as you want, using any read node and then saving the returned msg.payload as another key in the same msg, is an easy way to keep the previous payload.
Just need to add a function node and add the following
msg.NEWKEY= msg.payload
return msg
This will allow you to destroy the payload, having it available into msg.NEWKEY, for the following nodes.