Node needed that saves msg.payload and gives it out when triggered

Hello everyone,

I am looking for a node or another solution to save and pass through a msg.payload emitted by Node1.

If the payload comes from Node1 it should save the payload and pass it through like it isn’t even there. If however it gets triggered form Node2 it should pass the last saved payload through again without saving a new one or deleting the existing one.

Basically I need this to restore the state of a device to what I manually set it to after it got changed automatically (intened) by another flow.

https://nodered.org/docs/user-guide/writing-functions
read the section on storing data and use it in a function node

1 Like

Actually the video on this page is better.

https://nodered.org/docs/user-guide/context

This was surprisingly easy, thanks a lot!