Set a timestamp when something happens

Hello everyone,
I'm going crazy trying to find a simple solution to set a timestamp in my flow.
In practice I have a flow with inject every second and at the rising edge , from OFF to ON of a boolean, I would like to set a timestamp.

I can't find the solution, can anyone help me?

Do you mean that you get a series of messages like this?

false
false
false
true
true

What does "set a timestamp" mean -
Add msg.timestamp to the first msg where payload == true?
Set/change a global/flow/context variable?

Yes a receive
false
false
false
true
true

and at the first True i qould like to set a msg.payload.timestamp or flow.timestamp;

[{"id":"60aed1d242dbbb1b","type":"inject","z":"9df5622ef37b49d6","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"true","payloadType":"bool","x":110,"y":280,"wires":[["db3ac64fdd9c5da5"]]},{"id":"db3ac64fdd9c5da5","type":"rbe","z":"9df5622ef37b49d6","name":"block unless value changes","func":"rbe","gap":"","start":"","inout":"out","septopics":true,"property":"payload","topi":"topic","x":320,"y":300,"wires":[["2be7f55866c0ddab"]]},{"id":"23e3f7f4c3b49d54","type":"inject","z":"9df5622ef37b49d6","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"false","payloadType":"bool","x":110,"y":320,"wires":[["db3ac64fdd9c5da5"]]},{"id":"2be7f55866c0ddab","type":"switch","z":"9df5622ef37b49d6","name":"true?","property":"payload","propertyType":"msg","rules":[{"t":"true"}],"checkall":"true","repair":false,"outputs":1,"x":530,"y":300,"wires":[["302c89b39a40f5c0"]]},{"id":"302c89b39a40f5c0","type":"debug","z":"9df5622ef37b49d6","name":"debug 417","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":690,"y":300,"wires":[]}]
1 Like

it work ! thanks !

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.