How to separate two values of an object (temperature, humidity)

Hello, I would like to separate the two values of an object.
I'm trying with the split node, but it doesn't work.

Thanks


Screenshot_20240206_164148

Connect the MQTT to 2 separate change nodes (in parallel). The first one should copy payload.temoeratura to payload, other one should copy payload.humedad to payload

But first ensure you need to separate them. What do you want to do that needs that?

Using a split node you can copy the property name (key) to any message property you wish. You can then use that property in the switch node to route the messages.
e.g.

[{"id":"49fed7b68e0eedad","type":"inject","z":"d1395164b4eec73e","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"my/test.topic","payload":"{\"humedad\":50,\"temperatura\":20}","payloadType":"json","x":410,"y":4920,"wires":[["417f8eab2d2c0461"]]},{"id":"417f8eab2d2c0461","type":"split","z":"d1395164b4eec73e","name":"","splt":"\\n","spltType":"str","arraySplt":1,"arraySpltType":"len","stream":false,"addname":"key","x":570,"y":4920,"wires":[["f8527ef2a529d4cb"]]},{"id":"f8527ef2a529d4cb","type":"switch","z":"d1395164b4eec73e","name":"","property":"key","propertyType":"msg","rules":[{"t":"eq","v":"humedad","vt":"str"},{"t":"eq","v":"temperatura","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":730,"y":4920,"wires":[["87409c24e5857a1b"],["5d5853ad82a90c3d"]]},{"id":"87409c24e5857a1b","type":"debug","z":"d1395164b4eec73e","name":"debug 2481","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":930,"y":4880,"wires":[]},{"id":"5d5853ad82a90c3d","type":"debug","z":"d1395164b4eec73e","name":"debug 2482","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":930,"y":4960,"wires":[]}]

Or use the msg.parts.key that the split node creates.
e.g.

[{"id":"49fed7b68e0eedad","type":"inject","z":"d1395164b4eec73e","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"my/test.topic","payload":"{\"humedad\":50,\"temperatura\":20}","payloadType":"json","x":410,"y":4920,"wires":[["417f8eab2d2c0461"]]},{"id":"417f8eab2d2c0461","type":"split","z":"d1395164b4eec73e","name":"","splt":"\\n","spltType":"str","arraySplt":1,"arraySpltType":"len","stream":false,"addname":"","x":570,"y":4920,"wires":[["f8527ef2a529d4cb"]]},{"id":"f8527ef2a529d4cb","type":"switch","z":"d1395164b4eec73e","name":"","property":"parts.key","propertyType":"msg","rules":[{"t":"eq","v":"humedad","vt":"str"},{"t":"eq","v":"temperatura","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":730,"y":4920,"wires":[["87409c24e5857a1b"],["5d5853ad82a90c3d"]]},{"id":"87409c24e5857a1b","type":"debug","z":"d1395164b4eec73e","name":"debug 2481","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":930,"y":4880,"wires":[]},{"id":"5d5853ad82a90c3d","type":"debug","z":"d1395164b4eec73e","name":"debug 2482","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":930,"y":4960,"wires":[]}]

How to import/export a flow

In order to send separated values to influxDB.

Why do you want to send them separately to InfluxDB? You could store them in one measurement at the same time.

Which version of InfluxDB are you using?

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