Hi all,
i am still very new to NodeRed and I think I didn't understand the principle yet. What I would like to do is the following:
-
I have two MQTT inputs. "Input 1" sends data from my smart meter every 10 seconds into influxdb. "Input 2" sends data from my solar inverter every 1 second.
-
Now I would like to use one parameter from "Input 1" (fed-in energy) and one parameter from "Input 2" (generated energy, do some math with them and create a new message.payload that contains the manipulated variable.
My attempts so far:
- I used two function blocks for each MQTT input to create defined topic+payload objects.
- I routed both outputs to a "Join" node and configured it to "join each msg.payload" --> no output is shown in debug
Next attempt:
- I used two function blocks for each MQTT input to create defined topic+payload objects.
- I routed both outputs to a third function block and tried to create two individual variables.
var total_energy = msg.payload.Total_energy
var solar_energy = msg.payload.Solar
- I do my math on this and created a new message with:
Messsage = {topic: "Some topic", payload: new_variable}
However, when I check this in the debug console I just get "NaN" in the message.payload tab. If I just return one of the two variables I initializes at the beginning I get "undefined" in the message.payload tab.
Does anyone know what I am doing wrong? Is this because both inputs are not in sync (1s vs. 10s)? If not, how does node red handle this?
Thank you for enlighten me