[ { "id": "88892b5643b9bced", "type": "tab", "label": "influxdb", "disabled": false, "info": "", "env": [] }, { "id": "d191b66e9d55003e", "type": "influxdb out", "z": "88892b5643b9bced", "influxdb": "eeb221fb.ab27f", "name": "test", "measurement": "test", "precision": "", "retentionPolicy": "", "database": "mydb", "precisionV18FluxV20": "ms", "retentionPolicyV18Flux": "", "org": "organisation", "bucket": "bucket", "x": 490, "y": 560, "wires": [] }, { "id": "cb3b0ecc762dbf93", "type": "inject", "z": "88892b5643b9bced", "name": "", "props": [ { "p": "payload" } ], "repeat": "", "crontab": "", "once": false, "onceDelay": 0.1, "topic": "", "payload": "[{\"time\":1688718789,\"temperature\":47,\"humidity\":72},{\"device\":\"dQBgXeWLRE\",\"deviceType\":\"Pi4\",\"deviceName\":\"demo-pi-rob\"}]", "payloadType": "json", "x": 150, "y": 560, "wires": [ [ "d191b66e9d55003e" ] ] }, { "id": "87166c0dafdeea33", "type": "debug", "z": "88892b5643b9bced", "name": "debug 31", "active": true, "tosidebar": true, "console": false, "tostatus": false, "complete": "true", "targetType": "full", "statusVal": "", "statusType": "auto", "x": 500, "y": 320, "wires": [] }, { "id": "c041520701319d96", "type": "influxdb in", "z": "88892b5643b9bced", "influxdb": "eeb221fb.ab27f", "name": "", "query": "select * from sensors where \"name\" ='Porch'", "rawOutput": true, "precision": "", "retentionPolicy": "", "org": "organisation", "x": 310, "y": 320, "wires": [ [ "87166c0dafdeea33" ] ] }, { "id": "bc51887a66f2f65c", "type": "inject", "z": "88892b5643b9bced", "name": "query database", "props": [ { "p": "payload" }, { "p": "topic", "vt": "str" } ], "repeat": "", "crontab": "", "once": false, "onceDelay": 0.1, "topic": "", "payload": "select * from sensors where device = '0xE47E'", "payloadType": "str", "x": 120, "y": 280, "wires": [ [ "c041520701319d96" ] ] }, { "id": "fcf2c89fbb1ce660", "type": "mqtt in", "z": "88892b5643b9bced", "name": "", "topic": "sensors/#", "qos": "0", "datatype": "auto-detect", "broker": "c372d02c06d03179", "nl": false, "rap": true, "rh": 0, "inputs": 0, "x": 120, "y": 120, "wires": [ [ "fc251a727e61364b", "076e05f0179fdac8" ] ] }, { "id": "076e05f0179fdac8", "type": "debug", "z": "88892b5643b9bced", "name": "debug 107", "active": true, "tosidebar": true, "console": false, "tostatus": false, "complete": "true", "targetType": "full", "statusVal": "", "statusType": "auto", "x": 470, "y": 100, "wires": [] }, { "id": "ede8bcc868a6792c", "type": "influxdb out", "z": "88892b5643b9bced", "influxdb": "eeb221fb.ab27f", "name": "sensor data", "measurement": "sensors", "precision": "", "retentionPolicy": "", "database": "mydb", "precisionV18FluxV20": "ms", "retentionPolicyV18Flux": "", "org": "organisation", "bucket": "bucket", "x": 450, "y": 220, "wires": [] }, { "id": "fc251a727e61364b", "type": "function", "z": "88892b5643b9bced", "name": "function 101", "func": "let payload=msg.payload;\nlet msg_out=[];\nlet temp={};\nlet temp1={};\nlet d= new Date();\nlet now=d.getTime();\nif (\"Temperature\" in payload) {\n if (\"Humidity\" in payload) {\n temp = { \"time\":now,\"temperature\": payload.Temperature, \"humidity\": payload.Humidity };\n temp1 = { \"device\": payload.Device, \"name\": payload.Name};\n msg_out.push(temp);\n msg_out.push(temp1);\n msg.payload = msg_out;\n return msg;\n \n }\n\n}\n", "outputs": 1, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 230, "y": 220, "wires": [ [ "edbbe90d74faeddd", "ede8bcc868a6792c" ] ] }, { "id": "edbbe90d74faeddd", "type": "debug", "z": "88892b5643b9bced", "name": "debug 108", "active": true, "tosidebar": true, "console": false, "tostatus": false, "complete": "true", "targetType": "full", "statusVal": "", "statusType": "auto", "x": 470, "y": 160, "wires": [] }, { "id": "0f406ef2233a850c", "type": "inject", "z": "88892b5643b9bced", "name": "query using msg.query", "props": [ { "p": "query", "v": "select * from sensors where \"name\"='kitchen'", "vt": "str" }, { "p": "topic", "vt": "str" } ], "repeat": "", "crontab": "", "once": false, "onceDelay": 0.1, "topic": "", "x": 140, "y": 420, "wires": [ [ "f3e5b7359a795c09" ] ] }, { "id": "f3e5b7359a795c09", "type": "influxdb in", "z": "88892b5643b9bced", "influxdb": "eeb221fb.ab27f", "name": "", "query": "", "rawOutput": true, "precision": "", "retentionPolicy": "", "org": "organisation", "x": 330, "y": 420, "wires": [ [ "87166c0dafdeea33" ] ] }, { "id": "eeb221fb.ab27f", "type": "influxdb", "hostname": "127.0.0.1", "port": "8086", "protocol": "http", "database": "mydb", "name": "mydb", "usetls": false, "tls": "d50d0c9f.31e858", "influxdbVersion": "1.x", "url": "http://localhost:8086", "rejectUnauthorized": true }, { "id": "c372d02c06d03179", "type": "mqtt-broker", "name": "mqtt2.home", "broker": "192.168.1.37", "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": {}, "userProps": "", "sessionExpiry": "" }, { "id": "d50d0c9f.31e858", "type": "tls-config", "name": "", "cert": "", "key": "", "ca": "", "certname": "", "keyname": "", "caname": "", "servername": "", "verifyservercert": false } ]