MQTT Topic TTN

Post this so we can make sure the decoder is working correctly.

Then we can give attention to the change node and last to make sure the data is correct in the DB.

Good morning.
In the screenshot below you can see the payload directly after the “MQTT node” as requested.
Screenshot (36)
As you can see the payload is decoded as a Java object payload and the distance is printed without the mm.

Thank you very much in advance.

Ok.

Now make sure your change node does it’s job correctly. For the two highlighted fields I will copy and past from the JSON, as typos are easy to be made.

There is a button on the right of the debug window that does this job.
85R6RbPvqs

I will wright the EUI and the sensor value to the DB, if I were you.

image

Now check the JSON form the change node and see if that is correct.

Thank you for your reply as well in this topic!

Im saving both of them so I now exactly which device made this measurement?

You mean I need to check what I’m getting after the change node?
As far as I understand what you want me to know I made to debug nodes. One with the “msg.payload” and one with the “msg.dev_eui”.
is this what you meant?

Thank you very much in advance!

Yes, as you can use the same DB for all your sensors.

Put the debug node and post the JSON

Thank you for your reply!

Screenshot (38)
As you can see I’m having some trouble with the change node or to be more precise with the “dev_eui”.
I configured the change node as I posted in the picture before but I’m getting the message that the “msg.dev_eui” is undefined.

I’m not sure why…

Cool!

Did you use the “Copy Path” button in node-red?

Yes, I did and it copied the path I posted before.
I will try to copy the application_id for identification. there’s only one Node in this application and there will be no other Node.
That should be okay to identify the device.

Are there a value in the “dev_eui”? As TTN always forwards this…

What happens if you decide you need a second device?

Screenshot (39)
Yes there is a value in the “dev_eui” row.

Then everything would be broken…
You are right… in two years or so I probably don’t know this anymore and would add another device…

But im not sure why this is happening… I meant there is a dev_eui so why is it saying its undefined?

What bugs me is that you getting two separate JSON, one for the “Distance” and “dev_eui” out of the change node, that all should be in the same JSON.

Well, I’m getting them in two because we are making two or am I wrong?
msg.payload and msg.dev_eui.

Copy and past your flow from node-red, then I can look.

Don’t worry Node-red leaves all the keys and passwords out.

[
    {
        "id": "153ff67d1f2c61b8",
        "type": "tab",
        "label": "Flow 2",
        "disabled": false,
        "info": "",
        "env": []
    },
    {
        "id": "8e52c3ed8907ee0c",
        "type": "mqtt in",
        "z": "153ff67d1f2c61b8",
        "name": "Füllstand Quelle",
        "topic": "v3/DEVICEID@ttn/devices/+/up",
        "qos": "2",
        "datatype": "json",
        "broker": "0a4f4fef6fee57c6",
        "nl": false,
        "rap": true,
        "rh": 0,
        "inputs": 0,
        "x": 260,
        "y": 260,
        "wires": [
            [
                "059296a9a604036f",
                "1ae3c6d92610a908"
            ]
        ]
    },
    {
        "id": "059296a9a604036f",
        "type": "change",
        "z": "153ff67d1f2c61b8",
        "name": "change node",
        "rules": [
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "payload.uplink_message.decoded_payload.Distance",
                "tot": "msg"
            },
            {
                "t": "set",
                "p": "dev_eui",
                "pt": "msg",
                "to": "payload.end_device_ids.dev_eui",
                "tot": "msg"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 470,
        "y": 260,
        "wires": [
            [
                "08529e03113c98e2",
                "c4aa3711222d1081"
            ]
        ]
    },
    {
        "id": "08529e03113c98e2",
        "type": "debug",
        "z": "153ff67d1f2c61b8",
        "name": "",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "payload",
        "targetType": "msg",
        "statusVal": "",
        "statusType": "auto",
        "x": 990,
        "y": 280,
        "wires": []
    },
    {
        "id": "1ae3c6d92610a908",
        "type": "debug",
        "z": "153ff67d1f2c61b8",
        "name": "",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "payload",
        "targetType": "msg",
        "statusVal": "",
        "statusType": "auto",
        "x": 430,
        "y": 180,
        "wires": []
    },
    {
        "id": "c4aa3711222d1081",
        "type": "debug",
        "z": "153ff67d1f2c61b8",
        "name": "",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "dev_eui",
        "targetType": "msg",
        "statusVal": "",
        "statusType": "auto",
        "x": 990,
        "y": 240,
        "wires": []
    },
    {
        "id": "0a4f4fef6fee57c6",
        "type": "mqtt-broker",
        "name": "Füllstand Quelle",
        "broker": "eu1.cloud.thethings.network",
        "port": "1883",
        "clientid": "",
        "autoConnect": true,
        "usetls": false,
        "protocolVersion": "4",
        "keepalive": "60",
        "cleansession": true,
        "birthTopic": "",
        "birthQos": "0",
        "birthPayload": "",
        "birthMsg": {},
        "closeTopic": "",
        "closeQos": "0",
        "closePayload": "",
        "closeMsg": {},
        "willTopic": "",
        "willQos": "0",
        "willPayload": "",
        "willMsg": {},
        "sessionExpiry": ""
    }
]

Thats the flow

You have added a few thing that aided in the confusion.

You should rather keep your debug node set to as below.

image

This way you only get part of the JSON

image

I have corrected your flow, you will see there is a “Test Json”, if I hade you JSON I could have solved the problem faster.

You should be good now to inject the JSON into the Influx DB node and have the correct data in the DB.

[
    {
        "id": "153ff67d1f2c61b8",
        "type": "tab",
        "label": "Flow 2",
        "disabled": false,
        "info": "",
        "env": []
    },
    {
        "id": "8e52c3ed8907ee0c",
        "type": "mqtt in",
        "z": "153ff67d1f2c61b8",
        "name": "Füllstand Quelle",
        "topic": "v3/DEVICEID@ttn/devices/+/up",
        "qos": "2",
        "datatype": "json",
        "broker": "0a4f4fef6fee57c6",
        "nl": false,
        "rap": true,
        "rh": 0,
        "inputs": 0,
        "x": 220,
        "y": 260,
        "wires": [
            [
                "059296a9a604036f"
            ]
        ]
    },
    {
        "id": "059296a9a604036f",
        "type": "change",
        "z": "153ff67d1f2c61b8",
        "name": "change node",
        "rules": [
            {
                "t": "set",
                "p": "Distance",
                "pt": "msg",
                "to": "payload.uplink_message.decoded_payload.Distance",
                "tot": "msg"
            },
            {
                "t": "set",
                "p": "dev_eui",
                "pt": "msg",
                "to": "payload.end_device_ids.device_id",
                "tot": "msg"
            },
            {
                "t": "delete",
                "p": "payload.uplink_message",
                "pt": "msg"
            },
            {
                "t": "delete",
                "p": "payload.correlation_ids",
                "pt": "msg"
            },
            {
                "t": "delete",
                "p": "payload",
                "pt": "msg"
            },
            {
                "t": "delete",
                "p": "topic",
                "pt": "msg"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 510,
        "y": 260,
        "wires": [
            [
                "c4aa3711222d1081"
            ]
        ]
    },
    {
        "id": "1ae3c6d92610a908",
        "type": "debug",
        "z": "153ff67d1f2c61b8",
        "name": "",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "payload",
        "targetType": "msg",
        "statusVal": "",
        "statusType": "auto",
        "x": 530,
        "y": 360,
        "wires": []
    },
    {
        "id": "c4aa3711222d1081",
        "type": "debug",
        "z": "153ff67d1f2c61b8",
        "name": "",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": true,
        "complete": "true",
        "targetType": "full",
        "statusVal": "dev_eui",
        "statusType": "auto",
        "x": 670,
        "y": 260,
        "wires": []
    },
    {
        "id": "60f39d916a35dd8b",
        "type": "inject",
        "z": "153ff67d1f2c61b8",
        "name": "Test Json",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "{\"topic\":\"v3/compact-tracker-abeeway@ttn/devices/eui-20635f0161000093/up\",\"payload\":{\"end_device_ids\":{\"device_id\":\"eui-dhdfth\",\"application_ids\":{\"application_id\":\"fjdjdy\"},\"dev_eui\":\"hth3\",\"join_eui\":\"hrhxf\",\"dev_addr\":\"hhF\"},\"correlation_ids\":[\"as:up:01FPZ2ZC6PJQE0XQ68ECN239B7\",\"gs:conn:01FNXTS68EYM139F0J53QR5ZK0\",\"gs:up:host:01FNXTS699E4A2H7VSP45SZG62\",\"gs:uplink:01FPZ2ZC04E8WTWP10DHJX97S6\",\"ns:uplink:01FPZ2ZC0568ACBK2MBZQK4148\",\"rpc:/ttn.lorawan.v3.GsNs/HandleUplink:01FPZ2ZC052XX7N17EDTRCYW6D\",\"rpc:/ttn.lorawan.v3.NsAs/HandleUplink:01FPZ2ZC6MRZ4WAM86KEJC7J6B\"],\"received_at\":\"2021-12-15T13:02:16.279389076Z\",\"uplink_message\":{\"session_key_id\":\"AX23nQJEOCVpz1fId9ugRw==\",\"f_port\":18,\"f_cnt\":182,\"frm_payload\":\"BSBhigAQAgAAAwIA\",\"decoded_payload\":{\"ack\":0,\"batteryPersentage\":97,\"bleFirmware\":\"bleFwVersion3.2.0\",\"data\":0,\"Distance\":512,\"debug\":{\"length\":12,\"payload\":\"0520618a0010gfhfg030200\",\"port\":18,\"server_time\":\"2021-12-15T13:02:16.283Z\"},\"lastResetCause\":\"lastResetCause: 16\",\"mcuFirmware\":\"fwVersion: 2.0.0\",\"status\":{\"mode\":{\"code\":1,\"description\":\"Motion tracking\"},\"moving\":false,\"on_demand\":false,\"periodic\":false,\"sos\":false,\"tracking\":false},\"temperature\":25.81,\"type\":\"HEARTBEAT\"},\"rx_metadata\":[{\"gateway_ids\":{\"gateway_id\":\"dhdth-mdhdfhfn-01-dbn\",\"eui\":\"3dhdfhdfgh0\"},\"time\":\"2021-12-15T13:02:15.958012Z\",\"timestamp\":534735231,\"rssi\":-109,\"channel_rssi\":-109,\"snr\":1.75,\"location\":{\"latitude\":-505059.885050571,\"longitude\":5050.905081617,\"altitude\":225,\"source\":\"SOURCE_REGISTRY\"},\"uplink_token\":\"CiIKIAoUdGVjaDUtbWFsdmVybi0wMS1kYm4SCDQ2MjgkAFAAEP/S/f4BGgsI2M7njQYQ1+/aICCYsNCFyP3/ASoMCNfO540GEOC06MgD\",\"channel_index\":4}],\"settings\":{\"data_rate\":{\"lora\":{\"bandwidth\":125000,\"spreading_factor\":7}},\"coding_rate\":\"4/5\",\"frequency\":\"867300000\",\"timestamp\":534735231,\"time\":\"2021-12-15T13:02:15.958012Z\"},\"received_at\":\"2021-12-15T13:02:16.069864716Z\",\"consumed_airtime\":\"0.061696s\",\"locations\":{\"frm-payload\":{\"latitude\":-29.8889728,\"longitude\":30.916608,\"source\":\"SOURCE_GPS\"}},\"network_ids\":{\"net_id\":\"000013\",\"tenant_id\":\"ttn\",\"cluster_id\":\"ttn-eu1\"}}},\"qos\":0,\"retain\":false,\"_msgid\":\"d38de075552048d0\"}",
        "payloadType": "json",
        "x": 230,
        "y": 360,
        "wires": [
            [
                "99997bbb40d80fb0"
            ]
        ]
    },
    {
        "id": "99997bbb40d80fb0",
        "type": "change",
        "z": "153ff67d1f2c61b8",
        "name": "Test Json",
        "rules": [
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "payload.payload",
                "tot": "msg"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 360,
        "y": 360,
        "wires": [
            [
                "059296a9a604036f",
                "1ae3c6d92610a908"
            ]
        ]
    },
    {
        "id": "3f4efbddb8220f44",
        "type": "comment",
        "z": "153ff67d1f2c61b8",
        "name": "For Testing",
        "info": "",
        "x": 210,
        "y": 320,
        "wires": []
    },
    {
        "id": "0a4f4fef6fee57c6",
        "type": "mqtt-broker",
        "name": "Füllstand Quelle",
        "broker": "eu1.cloud.thethings.network",
        "port": "1883",
        "clientid": "",
        "autoConnect": true,
        "usetls": false,
        "protocolVersion": "4",
        "keepalive": "60",
        "cleansession": true,
        "birthTopic": "",
        "birthQos": "0",
        "birthPayload": "",
        "birthMsg": {},
        "closeTopic": "",
        "closeQos": "0",
        "closePayload": "",
        "closeMsg": {},
        "willTopic": "",
        "willQos": "0",
        "willPayload": "",
        "willMsg": {},
        "sessionExpiry": ""
    }
]

image

Thank you very much!
I like the solution and I’m very thankful for your very useful tips!
I also like the testing via the inject node. I did not know this trick… I just waited for the next payload from the LoraNode.

Okay first of all you are writing the distance and the deveui into msg.Distance and msg.deveui and then you are deleting everything from the stream we don’t want to save into the DB. Do I understand that correctly?

!The question is obsolete! I’ve found a solution!

Now I have an additional question. Now the “Distance” stands for the distance between an ultrasonic sensor and a water level.
Now I want to have the height of the water. The mathematical solution for this is to subtract"2300" from the measurement and multiply it by “-1”.
I’m pretty sure you would do this with a function node but I’m having trouble taking the msg.Distance and calculate with the number.

There is a “Copy Value” Button.

dwJ9uLCIM0

and past in inject node, press the … and delete what ever is in the window and past your JSON, hit “Done”, Done" and “Deploy”

Now you can inject your JSON into the flow.

image

Some math in the function node, or you can save DB space and do it when you display the data, if you use Grafana or the likes easy to do there.

I don’t like extra long JSON, only the necessities.

Save the electrons from flowing :smiling_imp:

[
    {
        "id": "153ff67d1f2c61b8",
        "type": "tab",
        "label": "Flow 2",
        "disabled": false,
        "info": "",
        "env": []
    },
    {
        "id": "8e52c3ed8907ee0c",
        "type": "mqtt in",
        "z": "153ff67d1f2c61b8",
        "name": "Füllstand Quelle",
        "topic": "v3/DEVICEID@ttn/devices/+/up",
        "qos": "2",
        "datatype": "json",
        "broker": "0a4f4fef6fee57c6",
        "nl": false,
        "rap": true,
        "rh": 0,
        "inputs": 0,
        "x": 220,
        "y": 260,
        "wires": [
            [
                "059296a9a604036f"
            ]
        ]
    },
    {
        "id": "059296a9a604036f",
        "type": "change",
        "z": "153ff67d1f2c61b8",
        "name": "change node",
        "rules": [
            {
                "t": "set",
                "p": "Distance",
                "pt": "msg",
                "to": "payload.uplink_message.decoded_payload.Distance",
                "tot": "msg"
            },
            {
                "t": "set",
                "p": "dev_eui",
                "pt": "msg",
                "to": "payload.end_device_ids.device_id",
                "tot": "msg"
            },
            {
                "t": "delete",
                "p": "payload.uplink_message",
                "pt": "msg"
            },
            {
                "t": "delete",
                "p": "payload.correlation_ids",
                "pt": "msg"
            },
            {
                "t": "delete",
                "p": "payload",
                "pt": "msg"
            },
            {
                "t": "delete",
                "p": "topic",
                "pt": "msg"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 510,
        "y": 260,
        "wires": [
            [
                "a99ae555ccc4abb5"
            ]
        ]
    },
    {
        "id": "1ae3c6d92610a908",
        "type": "debug",
        "z": "153ff67d1f2c61b8",
        "name": "",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "payload",
        "targetType": "msg",
        "statusVal": "",
        "statusType": "auto",
        "x": 530,
        "y": 360,
        "wires": []
    },
    {
        "id": "c4aa3711222d1081",
        "type": "debug",
        "z": "153ff67d1f2c61b8",
        "name": "",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": true,
        "complete": "true",
        "targetType": "full",
        "statusVal": "dev_eui",
        "statusType": "auto",
        "x": 870,
        "y": 260,
        "wires": []
    },
    {
        "id": "60f39d916a35dd8b",
        "type": "inject",
        "z": "153ff67d1f2c61b8",
        "name": "Test Json",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "{\"topic\":\"v3/compact-tracker-abeeway@ttn/devices/eui-20635f0161000093/up\",\"payload\":{\"end_device_ids\":{\"device_id\":\"eui-dhdfth\",\"application_ids\":{\"application_id\":\"fjdjdy\"},\"dev_eui\":\"hth3\",\"join_eui\":\"hrhxf\",\"dev_addr\":\"hhF\"},\"correlation_ids\":[\"as:up:01FPZ2ZC6PJQE0XQ68ECN239B7\",\"gs:conn:01FNXTS68EYM139F0J53QR5ZK0\",\"gs:up:host:01FNXTS699E4A2H7VSP45SZG62\",\"gs:uplink:01FPZ2ZC04E8WTWP10DHJX97S6\",\"ns:uplink:01FPZ2ZC0568ACBK2MBZQK4148\",\"rpc:/ttn.lorawan.v3.GsNs/HandleUplink:01FPZ2ZC052XX7N17EDTRCYW6D\",\"rpc:/ttn.lorawan.v3.NsAs/HandleUplink:01FPZ2ZC6MRZ4WAM86KEJC7J6B\"],\"received_at\":\"2021-12-15T13:02:16.279389076Z\",\"uplink_message\":{\"session_key_id\":\"AX23nQJEOCVpz1fId9ugRw==\",\"f_port\":18,\"f_cnt\":182,\"frm_payload\":\"BSBhigAQAgAAAwIA\",\"decoded_payload\":{\"ack\":0,\"batteryPersentage\":97,\"bleFirmware\":\"bleFwVersion3.2.0\",\"data\":0,\"Distance\":512,\"debug\":{\"length\":12,\"payload\":\"0520618a0010gfhfg030200\",\"port\":18,\"server_time\":\"2021-12-15T13:02:16.283Z\"},\"lastResetCause\":\"lastResetCause: 16\",\"mcuFirmware\":\"fwVersion: 2.0.0\",\"status\":{\"mode\":{\"code\":1,\"description\":\"Motion tracking\"},\"moving\":false,\"on_demand\":false,\"periodic\":false,\"sos\":false,\"tracking\":false},\"temperature\":25.81,\"type\":\"HEARTBEAT\"},\"rx_metadata\":[{\"gateway_ids\":{\"gateway_id\":\"dhdth-mdhdfhfn-01-dbn\",\"eui\":\"3dhdfhdfgh0\"},\"time\":\"2021-12-15T13:02:15.958012Z\",\"timestamp\":534735231,\"rssi\":-109,\"channel_rssi\":-109,\"snr\":1.75,\"location\":{\"latitude\":-505059.885050571,\"longitude\":5050.905081617,\"altitude\":225,\"source\":\"SOURCE_REGISTRY\"},\"uplink_token\":\"CiIKIAoUdGVjaDUtbWFsdmVybi0wMS1kYm4SCDQ2MjgkAFAAEP/S/f4BGgsI2M7njQYQ1+/aICCYsNCFyP3/ASoMCNfO540GEOC06MgD\",\"channel_index\":4}],\"settings\":{\"data_rate\":{\"lora\":{\"bandwidth\":125000,\"spreading_factor\":7}},\"coding_rate\":\"4/5\",\"frequency\":\"867300000\",\"timestamp\":534735231,\"time\":\"2021-12-15T13:02:15.958012Z\"},\"received_at\":\"2021-12-15T13:02:16.069864716Z\",\"consumed_airtime\":\"0.061696s\",\"locations\":{\"frm-payload\":{\"latitude\":-29.8889728,\"longitude\":30.916608,\"source\":\"SOURCE_GPS\"}},\"network_ids\":{\"net_id\":\"000013\",\"tenant_id\":\"ttn\",\"cluster_id\":\"ttn-eu1\"}}},\"qos\":0,\"retain\":false,\"_msgid\":\"d38de075552048d0\"}",
        "payloadType": "json",
        "x": 230,
        "y": 360,
        "wires": [
            [
                "99997bbb40d80fb0"
            ]
        ]
    },
    {
        "id": "99997bbb40d80fb0",
        "type": "change",
        "z": "153ff67d1f2c61b8",
        "name": "Test Json",
        "rules": [
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "payload.payload",
                "tot": "msg"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 360,
        "y": 360,
        "wires": [
            [
                "059296a9a604036f",
                "1ae3c6d92610a908"
            ]
        ]
    },
    {
        "id": "3f4efbddb8220f44",
        "type": "comment",
        "z": "153ff67d1f2c61b8",
        "name": "For Testing",
        "info": "",
        "x": 210,
        "y": 320,
        "wires": []
    },
    {
        "id": "a99ae555ccc4abb5",
        "type": "function",
        "z": "153ff67d1f2c61b8",
        "name": "level",
        "func": "msg.level =  msg.Distance - 2300\n\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 700,
        "y": 260,
        "wires": [
            [
                "c4aa3711222d1081"
            ]
        ]
    },
    {
        "id": "0a4f4fef6fee57c6",
        "type": "mqtt-broker",
        "name": "Füllstand Quelle",
        "broker": "eu1.cloud.thethings.network",
        "port": "1883",
        "clientid": "",
        "autoConnect": true,
        "usetls": false,
        "protocolVersion": "4",
        "keepalive": "60",
        "cleansession": true,
        "birthTopic": "",
        "birthQos": "0",
        "birthPayload": "",
        "birthMsg": {},
        "closeTopic": "",
        "closeQos": "0",
        "closePayload": "",
        "closeMsg": {},
        "willTopic": "",
        "willQos": "0",
        "willPayload": "",
        "willMsg": {},
        "sessionExpiry": ""
    }
]

Very cool!

Okay that’s as i expected another approach to this “problem”.
I installed a calculator Plugin and did it with this.

[
    {
        "id": "dec69ff8f39faf70",
        "type": "tab",
        "label": "Flow 2",
        "disabled": false,
        "info": "",
        "env": []
    },
    {
        "id": "9c6d69e06c2386f7",
        "type": "change",
        "z": "dec69ff8f39faf70",
        "name": "change node",
        "rules": [
            {
                "t": "set",
                "p": "Distance",
                "pt": "msg",
                "to": "payload.uplink_message.decoded_payload.Distance",
                "tot": "msg"
            },
            {
                "t": "set",
                "p": "dev_eui",
                "pt": "msg",
                "to": "payload.end_device_ids.device_id",
                "tot": "msg"
            },
            {
                "t": "delete",
                "p": "payload.uplink_message",
                "pt": "msg"
            },
            {
                "t": "delete",
                "p": "payload.correlation_ids",
                "pt": "msg"
            },
            {
                "t": "delete",
                "p": "payload",
                "pt": "msg"
            },
            {
                "t": "delete",
                "p": "topic",
                "pt": "msg"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 430,
        "y": 240,
        "wires": [
            [
                "c7fe070daa6649a2"
            ]
        ]
    },
    {
        "id": "9a2ef07e29a54a89",
        "type": "debug",
        "z": "dec69ff8f39faf70",
        "name": "",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": true,
        "complete": "true",
        "targetType": "full",
        "statusVal": "dev_eui",
        "statusType": "auto",
        "x": 950,
        "y": 60,
        "wires": []
    },
    {
        "id": "c7fe070daa6649a2",
        "type": "calculator",
        "z": "dec69ff8f39faf70",
        "name": "-2300",
        "inputMsgField": "Distance",
        "outputMsgField": "Distance",
        "operation": "sub",
        "constant": "2300",
        "round": true,
        "decimals": "2",
        "x": 550,
        "y": 180,
        "wires": [
            [
                "dc8fb232d449aaa2"
            ]
        ]
    },
    {
        "id": "dc8fb232d449aaa2",
        "type": "calculator",
        "z": "dec69ff8f39faf70",
        "name": "x-1",
        "inputMsgField": "Distance",
        "outputMsgField": "Distance",
        "operation": "mult",
        "constant": "-1",
        "round": true,
        "decimals": "2",
        "x": 670,
        "y": 140,
        "wires": [
            [
                "11f0bf4bb0abba44"
            ]
        ]
    },
    {
        "id": "11f0bf4bb0abba44",
        "type": "calculator",
        "z": "dec69ff8f39faf70",
        "name": "x1,64x1,417",
        "inputMsgField": "Distance",
        "outputMsgField": "Füllmenge",
        "operation": "mult",
        "constant": "2.32388",
        "round": true,
        "decimals": "0",
        "x": 810,
        "y": 100,
        "wires": [
            [
                "9a2ef07e29a54a89",
                "ba2599eea969d74a"
            ]
        ]
    },
    {
        "id": "ba2599eea969d74a",
        "type": "influxdb out",
        "z": "dec69ff8f39faf70",
        "influxdb": "9f2a7e530ba069af",
        "name": "Influxdb fuellstandquelle",
        "measurement": "distanz",
        "precision": "",
        "retentionPolicy": "",
        "database": "database",
        "precisionV18FluxV20": "ms",
        "retentionPolicyV18Flux": "",
        "org": "organisation",
        "bucket": "bucket",
        "x": 1010,
        "y": 140,
        "wires": []
    },
    {
        "id": "06f471c9d70fc21f",
        "type": "mqtt in",
        "z": "dec69ff8f39faf70",
        "name": "Füllstand Quelle",
        "topic": "v3/fuellstandquelle@ttn/devices/+/up",
        "qos": "2",
        "datatype": "json",
        "broker": "0a4f4fef6fee57c6",
        "nl": false,
        "rap": true,
        "rh": 0,
        "inputs": 0,
        "x": 140,
        "y": 240,
        "wires": [
            [
                "9c6d69e06c2386f7",
                "4962ee966ff9499e"
            ]
        ]
    },
    {
        "id": "4962ee966ff9499e",
        "type": "debug",
        "z": "dec69ff8f39faf70",
        "name": "",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "payload",
        "targetType": "msg",
        "statusVal": "",
        "statusType": "auto",
        "x": 310,
        "y": 160,
        "wires": []
    },
    {
        "id": "9f2a7e530ba069af",
        "type": "influxdb",
        "hostname": "localhost",
        "port": "8086",
        "protocol": "http",
        "database": "fuellstandquelle",
        "name": "Influx DB fuellstandquelle",
        "usetls": false,
        "tls": "",
        "influxdbVersion": "1.x",
        "url": "http://localhost:8086",
        "rejectUnauthorized": true
    },
    {
        "id": "0a4f4fef6fee57c6",
        "type": "mqtt-broker",
        "name": "Füllstand Quelle",
        "broker": "eu1.cloud.thethings.network",
        "port": "1883",
        "clientid": "",
        "autoConnect": true,
        "usetls": false,
        "protocolVersion": "4",
        "keepalive": "60",
        "cleansession": true,
        "birthTopic": "",
        "birthQos": "0",
        "birthPayload": "",
        "birthMsg": {},
        "closeTopic": "",
        "closeQos": "0",
        "closePayload": "",
        "closeMsg": {},
        "willTopic": "",
        "willQos": "0",
        "willPayload": "",
        "willMsg": {},
        "sessionExpiry": ""
    }
]

That is my approach and it’s working and I’m fine with that…
Thats the calculator if you need it.

But I can’t save the result into my db.

Screenshot (42)
Screenshot (44)
Screenshot (43)