Adding Certain data tags to a data received by a sensor

I believe the second one is more appropriate for what I want but I have to do this for all the variables I am having right now. Because this is only gives the output for TempHumi. One more question, this process now should be done automatically? In other words, I am receiving the data every 10 secs, the newer values will replace the old values or this might be more appropriate for static values?

I think you have been asked more than once to show us the output you want. This is what you said:

Now you want something more. I trust that you can work out for yourself how to extend the "Reformat" function that I posted.
You will probably find it useful to feed your input data to a debug node, expand the objects it contains and use the "Copy path" button.

The way Node-red works is that the code in the Reformat node will be applied to whatever data you feed in to it.
So however you get your sensor data - HTML request, MQTT, the output of an external script - feed it into Reformat and if it is the expected format, it will be reformatted.

ps
In your original post you said this was the desired output

I would like to change this data tags to match this format: {line}.{unit/system/function}.{device/function}[.{device/function}[...]].property

I can't recognise that format in the quote I gave above.

You can use Object.entries() and iterate all the keys in the object and change the keys to the new ones. See Object.entries() - JavaScript | MDN

Okay thanks, I have one more question. you told me in a previous reply it will be different if I want it as a nested function. out of curiosity, is it possible to give me an example how will it be look like?

When you tested the code in post #15 what result did it give?
msg.payload = {Line_1: {HA20: {Temperature: {Temperature: msg.payload}}}}}

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