Calculations with values from array

polareisbaer
Tue, 13 Aug 2024 09:33:22 +0000
Dashboard

Hello,

I have a problem with two arrays. I want to calculate with two values from the arrays but get stuck when merging them.
I want to put the values of round and max in relation ( round*100/max ).

[
    {
        "id": "fba9ba0d3c274116",
        "type": "inject",
        "z": "02fda711f61a8cbb",
        "name": "Select * from db1",
        "props": [
            {
                "p": "query",
                "v": "SELECT ROUND(DIFFERENCE(max(VALUE_1))*100)/100 FROM mqtt_consumer WHERE (topic='tele/tasmota_1/SENSOR') and (time >= now() - 3d) Group by time(1d)",
                "vt": "str"
            }
        ],
        "repeat": "600",
        "crontab": "",
        "once": true,
        "onceDelay": 0.1,
        "topic": "",
        "x": 210,
        "y": 560,
        "wires": [
            [
                "677ff0330cc21702"
            ]
        ]
    },
    {
        "id": "677ff0330cc21702",
        "type": "influxdb in",
        "z": "02fda711f61a8cbb",
        "influxdb": "fb1c96812bb5b413",
        "name": "DB1",
        "query": "",
        "rawOutput": false,
        "precision": "",
        "retentionPolicy": "",
        "org": "organisation",
        "x": 410,
        "y": 560,
        "wires": [
            [
                "47a1e6dca0d0efc1",
                "e4fe26a503dbb0e6"
            ]
        ]
    },
    {
        "id": "024576c1e9084aad",
        "type": "inject",
        "z": "02fda711f61a8cbb",
        "name": "Select * from db2",
        "props": [
            {
                "p": "query",
                "v": "SELECT max(\"value\") from mqtt_consumer WHERE (topic='tele/tasmota_2/SENSOR') and (time >= now() - 3d) Group by time(1d)",
                "vt": "str"
            }
        ],
        "repeat": "300",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "x": 220,
        "y": 640,
        "wires": [
            [
                "733cb51e55a28d7e"
            ]
        ]
    },
    {
        "id": "733cb51e55a28d7e",
        "type": "influxdb in",
        "z": "02fda711f61a8cbb",
        "influxdb": "69cee814.fcbdb8",
        "name": "DB2",
        "query": "",
        "rawOutput": false,
        "precision": "",
        "retentionPolicy": "",
        "org": "organisation",
        "x": 420,
        "y": 640,
        "wires": [
            [
                "47a1e6dca0d0efc1",
                "e4fe26a503dbb0e6"
            ]
        ]
    },
    {
        "id": "fb1c96812bb5b413",
        "type": "influxdb",
        "hostname": "192.168.1.10",
        "port": "8086",
        "protocol": "http",
        "database": "db1",
        "name": "db1",
        "usetls": false,
        "tls": "",
        "influxdbVersion": "1.x",
        "url": "http://localhost:8086",
        "rejectUnauthorized": true
    },
    {
        "id": "69cee814.fcbdb8",
        "type": "influxdb",
        "hostname": "192.168.1.20",
        "port": "8086",
        "protocol": "http",
        "database": "db2",
        "name": "",
        "usetls": false,
        "tls": "",
        "influxdbVersion": "1.x",
        "url": "http://localhost:8086",
        "rejectUnauthorized": false
    }
]

11 posts - 7 participants