Current_state node: Passing on payload of input?

Hi !
I am fresh to node red and I am stuck wirh current_state node which outputs the state of the entity I am checking against. But I want to have the original payload on output (when condition is met). Should be easy, but I haven’t found out how. Any hints ?

Example: current_state node named “is_dark?” checks illumination sensor and should pass payload “on”/“off” from input to output. But I get the illumination level on output if the condition is met instead.

TIA.

image

2 Likes

The arrow could also point towards the payload word, which can be changed to something else.

excellent. Thanks !

Can someone explain this further? I want to pass on the previous payload unchanged using this node as a gate.

I don’t know what to do based on your answer. I tried removing the msg. payload output and both payload and data output but that didn’t work.

I see in the help text it says, “Original value stored in msg.data.original_state .” I am not sure how to use that though.

update:
Well I figured it out. It does work as I want by using msg.data= entity and passing on the original payload. My problem was that I had to add a 10 ms delay to allow other flows to catch up and change the state that I was checking for at this current_state node.

I don’t, however, really understand conceptually why setting output to only msg.data= entity will pass the original payload. Is it that the .data IS the original payload? Any explanation or link to help me out? Thanks.