Via a sensor connected to TTN LoRa I receive an MQTT message with the measured temperature and humidity:
payload.uplink_message.decoded_payload.TempC_SHT
payload.uplink_message.decoded_payload.Hum_SHT
My intention is to store the measurements in an Influx Database and therefore I first have to convert the above info to something like:
temp: 23.0
humi: 43.9
I have tried to do that with a Function Node but I did not succeed, probably because of my lack of knowledge. Can someone tell me the correct code to enter in that node?
[{"id":"7975535b.a29c1c","type":"tab","label":"Test LHT65","disabled":false,"info":""},{"id":"ab44a611.e93c38","type":"mqtt in","z":"7975535b.a29c1c","name":"MQTT #","topic":"#","qos":"2","datatype":"json","broker":"c1daf86e.852c98","x":240,"y":380,"wires":[["8f9758ff.9fad18","c499e849.b56128"]]},{"id":"8f9758ff.9fad18","type":"debug","z":"7975535b.a29c1c","name":"Temp","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload.uplink_message.decoded_payload.TempC_SHT","targetType":"msg","x":510,"y":260,"wires":[]},{"id":"c1840ce.1ae62f","type":"influxdb out","z":"7975535b.a29c1c","influxdb":"30c360.5b7f3ca","name":"DB Lucht","measurement":"","precision":"","retentionPolicy":"","x":700,"y":420,"wires":[]},{"id":"fa76fbf5.821468","type":"function","z":"7975535b.a29c1c","name":"","func":"\nreturn msg;","outputs":1,"noerr":0,"x":510,"y":420,"wires":[["c1840ce.1ae62f"]]},{"id":"c499e849.b56128","type":"debug","z":"7975535b.a29c1c","name":"Humi","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload.uplink_message.decoded_payload.Hum_SHT","targetType":"msg","x":510,"y":320,"wires":[]},{"id":"c1daf86e.852c98","type":"mqtt-broker","z":"","name":"Kanweg","broker":"eu1.cloud.thethings.network","port":"1883","clientid":"","usetls":false,"compatmode":false,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","closeTopic":"","closeQos":"0","closePayload":"","willTopic":"","willQos":"0","willPayload":""},{"id":"30c360.5b7f3ca","type":"influxdb","z":"","hostname":"192.168.2.185","port":"8086","protocol":"http","database":"lucht","name":"DB Lucht","usetls":false,"tls":""}]