diff --git a/software/flow/.flows.json.backup b/software/flow/.flows.json.backup index 62e845b..3dd2fcf 100644 --- a/software/flow/.flows.json.backup +++ b/software/flow/.flows.json.backup @@ -24,8 +24,8 @@ { "id": "7ce136dbb8c897d1", "type": "mqtt-broker", - "name": "192.168.2.103:1833", - "broker": "192.168.2.103", + "name": "mosquitto:1833", + "broker": "mosquitto", "port": "1883", "clientid": "", "autoConnect": true, @@ -165,6 +165,33 @@ } } }, + { + "id": "eeb221fb.ab27f", + "type": "influxdb", + "hostname": "127.0.0.1", + "port": "8086", + "protocol": "http", + "database": "test", + "name": "test", + "usetls": true, + "tls": "d50d0c9f.31e858", + "influxdbVersion": "1.x", + "url": "http://localhost:8086", + "rejectUnauthorized": true + }, + { + "id": "d50d0c9f.31e858", + "type": "tls-config", + "name": "", + "cert": "", + "key": "", + "ca": "", + "certname": "", + "keyname": "", + "caname": "", + "servername": "", + "verifyservercert": false + }, { "id": "3cc11d24.ff01a2", "type": "comment", @@ -175,6 +202,62 @@ "y": 100, "wires": [] }, + { + "id": "39aa2ca9.804da4", + "type": "debug", + "z": "f6f2187d.f17ca8", + "name": "", + "active": true, + "tosidebar": true, + "console": false, + "tostatus": false, + "complete": "payload", + "targetType": "msg", + "statusVal": "", + "statusType": "auto", + "x": 670, + "y": 360, + "wires": [] + }, + { + "id": "262a3923.e7b216", + "type": "influxdb in", + "z": "f6f2187d.f17ca8", + "influxdb": "eeb221fb.ab27f", + "name": "", + "query": "SELECT * from test", + "rawOutput": false, + "precision": "", + "retentionPolicy": "", + "org": "my-org", + "x": 450, + "y": 360, + "wires": [ + [ + "39aa2ca9.804da4" + ] + ] + }, + { + "id": "803d82f.ff80f8", + "type": "inject", + "z": "f6f2187d.f17ca8", + "name": "", + "repeat": "", + "crontab": "", + "once": false, + "onceDelay": 0.1, + "topic": "", + "payload": "", + "payloadType": "date", + "x": 240, + "y": 360, + "wires": [ + [ + "262a3923.e7b216" + ] + ] + }, { "id": "e0977f2582bfaaa6", "type": "mqtt in", diff --git a/software/flow/.flows_cred.json.backup b/software/flow/.flows_cred.json.backup new file mode 100644 index 0000000..445a0eb --- /dev/null +++ b/software/flow/.flows_cred.json.backup @@ -0,0 +1,3 @@ +{ + "$": "2b099099e7732ecc4498978f475755f6UU2zgPJFd8JcqdknMyuTvMxV11RG2zk=" +} \ No newline at end of file diff --git a/software/flow/README.md b/software/flow/README.md index 55a697f..7d3b48c 100644 --- a/software/flow/README.md +++ b/software/flow/README.md @@ -36,4 +36,15 @@ You can view the dashboard in an (also mobile) web browser. ![Mobile view](./docs/images/5-dashboard.png) -Have a look at the flow also in [this repository](./00-dashboard-example/dashboard.json). \ No newline at end of file +Have a look at the flow also in [this repository](./00-dashboard-example/dashboard.json). + +## InfluxDB + +Already added to this project is [node-red-contrib-influxdb](https://flows.nodered.org/node/node-red-contrib-influxdb). You can use it's nodes to write and query data from an InfluxDB time series database. These nodes support both InfluxDB 1.x and InfluxDb 2.0 databases. At the time of this writing we are using [version 2.6 of InfluxDB on port 8086](http://admin:adminadmin@localhost:8086). + +# Links +* [IoT Made Easy with Node-RED and InfluxDB](https://www.influxdata.com/blog/iot-easy-node-red-influxdb/) +* A great tutorial can be found at [microcontrollerlab.com](https://microcontrollerslab.com/esp32-mqtt-publish-multiple-sensor-readings-node-red/) + + + diff --git a/software/flow/flows.json b/software/flow/flows.json index b325ba0..7cad056 100644 --- a/software/flow/flows.json +++ b/software/flow/flows.json @@ -165,6 +165,47 @@ } } }, + { + "id": "eeb221fb.ab27f", + "type": "influxdb", + "hostname": "127.0.0.1", + "port": "8086", + "protocol": "http", + "database": "test", + "name": "test", + "usetls": true, + "tls": "d50d0c9f.31e858", + "influxdbVersion": "1.x", + "url": "http://localhost:8086", + "rejectUnauthorized": true + }, + { + "id": "d50d0c9f.31e858", + "type": "tls-config", + "name": "", + "cert": "", + "key": "", + "ca": "", + "certname": "", + "keyname": "", + "caname": "", + "servername": "", + "verifyservercert": false + }, + { + "id": "d61a7da6caeb26aa", + "type": "influxdb", + "hostname": "influxdb", + "port": "8086", + "protocol": "http", + "database": "database", + "name": "influx", + "usetls": false, + "tls": "d50d0c9f.31e858", + "influxdbVersion": "2.0", + "url": "http://influx:8086", + "rejectUnauthorized": true + }, { "id": "3cc11d24.ff01a2", "type": "comment", @@ -175,6 +216,101 @@ "y": 100, "wires": [] }, + { + "id": "39aa2ca9.804da4", + "type": "debug", + "z": "f6f2187d.f17ca8", + "name": "", + "active": true, + "tosidebar": true, + "console": false, + "tostatus": false, + "complete": "payload", + "targetType": "msg", + "statusVal": "", + "statusType": "auto", + "x": 670, + "y": 360, + "wires": [] + }, + { + "id": "262a3923.e7b216", + "type": "influxdb in", + "z": "f6f2187d.f17ca8", + "influxdb": "eeb221fb.ab27f", + "name": "", + "query": "SELECT * from test", + "rawOutput": false, + "precision": "", + "retentionPolicy": "", + "org": "my-org", + "x": 450, + "y": 360, + "wires": [ + [ + "39aa2ca9.804da4" + ] + ] + }, + { + "id": "803d82f.ff80f8", + "type": "inject", + "z": "f6f2187d.f17ca8", + "name": "", + "repeat": "", + "crontab": "", + "once": false, + "onceDelay": 0.1, + "topic": "", + "payload": "", + "payloadType": "date", + "x": 240, + "y": 360, + "wires": [ + [ + "262a3923.e7b216" + ] + ] + }, + { + "id": "00a750cdfb54579e", + "type": "mqtt in", + "z": "f6f2187d.f17ca8", + "name": "", + "topic": "/iot-platform/energy-monitor/test-device/watt", + "qos": "1", + "datatype": "auto-detect", + "broker": "7ce136dbb8c897d1", + "nl": false, + "rap": true, + "rh": 0, + "inputs": 0, + "x": 270, + "y": 480, + "wires": [ + [ + "7e53d20583f56487" + ] + ] + }, + { + "id": "7e53d20583f56487", + "type": "influxdb out", + "z": "f6f2187d.f17ca8", + "influxdb": "d61a7da6caeb26aa", + "name": "Influx watt", + "measurement": "", + "precision": "", + "retentionPolicy": "", + "database": "database", + "precisionV18FluxV20": "ms", + "retentionPolicyV18Flux": "", + "org": "ccl", + "bucket": "test", + "x": 610, + "y": 480, + "wires": [] + }, { "id": "e0977f2582bfaaa6", "type": "mqtt in", diff --git a/software/flow/flows_cred.json b/software/flow/flows_cred.json index 445a0eb..d0bceb6 100644 --- a/software/flow/flows_cred.json +++ b/software/flow/flows_cred.json @@ -1,3 +1,3 @@ { - "$": "2b099099e7732ecc4498978f475755f6UU2zgPJFd8JcqdknMyuTvMxV11RG2zk=" + "$": "8a5830375d7cb047a920bc81b4cc476d+XU3NAfSPPxYBE1efxY1lIAusvuTCZCAU0damInvBBb4fzVvhMaUn60RLfr4AV7lMRCB2hbzc9MdqjzWd2JOC4ihNxhIKjYqZiqGAZ+dhJJ0U+FjxkCd" } \ No newline at end of file