Text before msg.payload

I need to put the word "temperature" before the number, as it appears on the right and below

How can I do it?
Thank you

The simple way is msg.payload = "temperature :" + Number(msg.payload) however, if this is for display on a dashboard or sending to MQTT/HTTP etc, then it is not the recommended solution.

Sorry, I have explained myself wrong.
I am trying to pass a data collected by Blynk to Thingspeak.
Doing tests I see that if I inject a numerical value with a temperature topic, that value is stored in thingspeak.

I see that the way it is stored correctly is with the statement
Temperatura : msg.payload : number

Here Temperature is the topic or field of Thingspeak.

So I need to be able to make that appear, or so I think...

Thank you

image

With this solution I was able to introduce the test value in thingspeak, but I don't know how to do it with the function and the Blynk node.

Thank you

I have no experience with the Blynk node but at a guess...

Put a change node before the Blynk node & set msg.topic to "temperature"

Or in the function node

msg.topic = "temperature"
return msg
1 Like

image

Thank you, I have solved it with this solution.

I need to understand and know how to write in this language. Do you recommend any course or tutorial?

Thank you

This online resource covers many languages including JavaScript. It also includes "Test yourself with exercises" sections, so you can try out pieces of code as you read through the material.

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