MQTT. Thingspeak

Recently i made a flow, which allow me to sent sensor data to thingspeak via http.

But now i try to make a flow to help me sent sensor data to thingspeak via mqtt ( Any help?

What do you need help with specifically? Add an MQTT node, configure it with whatever details thingspeak requires and then start passing it messages.

This is now the third thread that you have asked this question, but so far you have not addressed the questions asked.
To add to @knolleary's answer you want an MQTT Out node, not the mqtt server node that it seems you were trying to use previously.

I try this, but nothing.
Do I need an external server?

did you cofigure the mqtt-out node in that flow?

also please stay on one thread until you solve that issue so that people aren't working at cross purposes.

Yes, i cofigure it

in that case, add a mqtt-in node and use the same credentials you used for the output and enter the same topic used in the mqtt-out node. connect that to a debug node and then add an inject node connected to the mqtt-out node. Deploy and press the inject. You should see a message in the debug log coming from the debug node attached to the mqtt-in node. This way you can see if your mqtt settings are working

You have an external broker (it is called a broker for mqtt not a server), it is Thingspeak.
See the first line of

I made some flow (the flow sends data but with thingspeak nodes and when i remove the mqtt node the data still transmits in the cloud, so it use http, i suppose) in which i have inject node which triggers the entire flow, do i need second?
Do i need thingspeak node, and which on of them, because they are two types?
Do i need some extra function nodes in combination with the one from the initial example?

You don't appear to have considered @zenofmud's suggestion.

This is my old flow that i try to create before. I show you the flow to see what i've done so far. I wiil try the suggestion.

Assuming you mean node-red-contrib-thingspeak and ditto42 then they are both years old with unaddressed issues against them. Decide whether you want to use one of them or MQTT and go that way, don't try and use more than one, there is no point. Personally I would use MQTT.

I've made some flow and i've got this error from the function node.

The content of the function node is:

When i edit mqtt broker do i have to fill the client ID, and with what ? User API Key?

You need to hide any credentials on screen shots before posting them to the forum

Otherwise bad people could do bad things with them :frowning:

@Martin10 this is exactly the same error you had in another thread.

The error toString of undefined means one of the values you are trying to use toString on is not defined.

In your function code you are calling toString on both msg.payload.object and msg.payload.ambient

Where are you setting msg.payload.object and msg.payload.ambient? What does the message look like that you are passing into this function? Does it have those properties set on it?

I'm not good at programming. I just want to pass data from the DHT sensors to thingspeak via mqtt. This example i took from hire:

Ok, so that flow works because the mlx-sensor node it uses creates a message containing object and ambient as properties.

You have a different message coming from the DHT node - so you need to understand the structure of that message and identify what properties are the ones you want to send to Thingspeak.

From the other thread, you did share a picture showing the Debug output for the node - MQTT.FX Thingspeak

It appears you have msg.payload as the temperature reading and msg.humidty as the humidity.

So a starting point would be to replace msg.payload.object with msg.payload and replace msg.payload.ambient with msg.humidity in your Function node.

Thank you very much knolleary, it works!

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