Combine two messages with two topics

I've got a flow that creates two values with two topics and I would like to divide one by the other. Basically I've forgotten how to do it :roll_eyes:

The two topics are "on" and "off" which the payload is the on and off times in seconds of my fridge/freezer, I used my whole house power monitor to get the data at night when the power levels are more stable so I use the Hysteresis node and the interval timer node to get the on and off times.

I looked around but can't find a similar example.

See this article in the cookbook for an example of how to join messages into one object.

But how do I then divide one value by the other once combined ?

Feed the result of the join node into a function and divide the values then feed the answer into msg.payload and return the msg.

Attach a debug to the output of the join node to see what your joined data looks like.

1 Like

Ah ok thanks, I remember now it's been a while since I fiddled with NR got it now.

msg.payload = / msg.payload.two
return msg;

Simple when you remember :grinning_face_with_smiling_eyes:

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