I need some help to transform data form MQTT Trigger.
As I need to extract data (room name) from Topic name, I only activate JSON Parse Body option.
Then, I would like to transform the JSON form message to a table, exactly like if I had activated the message option in the MQTT Trigger. Do I need a function for this, or is there a node able to do so ?
If it’s a function, can you help with an example ?
I search the node or function called function1 in the following flow :
Now I just want to extract on the other hand the differents values from the body message, and the. multiplex it so it gets ready to insert into TimeScaleDB. I need the same exact result I easily get with options JSON Pase Body / Only message activated (but if I do this, I miss the topic path to get the room name).
If it is just posting and the visuals don’t matter in n8n what about just using $json[“message”].temperature, it looks like it is already an object so you should be able to just call it as it is whenever you need it or do it in a set node. You could also use {{$json[“topic”].split("/")[1]}} in the expression editor at any point as well.
Could be worth a go and you wouldn’t need to use a function node.
Bit hard to read on mobile but the theory looks good, if you use the expression builder to select the node you should be able to browse to the value you want.