Commit 996fdfee authored by schneider's avatar schneider
Browse files

update grafana tutorial

parent 5acdc4e1
Pipeline #5418 passed with stage
in 7 seconds
- Prepare system
- passwd
- configure any network interfaces as needed
- sudo apt update
- sudo apt upgrade
- sudo reboot
- sudo apt install git
- Install IOTstack
- git clone https://github.com/SensorsIot/IOTstack.git IOTstack
- cd ~/IOTstack
- ./menu.sh
- let it install dependencies
- restart when asked
- edit `/etc/group` and add `pi` to the `docker` group
- log out
- login again, run menu.sh again
- ignore error message because of docker version
- select "Build Stack"
- select grafana, influxdb, nodered using space
- enter node red menu, build addons list
- add generic ble to list
- hit enter
- go to docker commands
- select start stack
- wait for containers being built
- use bluetoothctl to pair the card10
- `scan on`
- enter bluetooth menu on card10
- `pair CA:4D:10:01:FF:64` (replace with MAC that is shown in bluetooth memnu)
- type `yes`, hit yes on card10
- `disconnect CA:4D:10:01:FF:64`
- `exit`
- create influx database
- `docker exec -it influxdb influx`
- `create database card10`
- (use card10)
- `create user "nodered" with password 'supersecure'`
- `create user "grafana" with password 'supersecure'`
- `grant all on card10 to nodered`
- `grant all on card10 to grafana`
- configure grafana
- ip:3000
- admin, admin
- select a new password
- add new data source influxdb
- url `http://influxdb:8086`
- database card10
- user grafana
- password supersecure
- method GET
- add card10 in nodered
- go to ip:1880
- import flow.json
- change mac of device to CA:4D:10:01:FF:64 (same as above)
- set user of influxdb to `nodered`
- set password of influxdb to `supersecure`
- deploy flow
- reboot. check that card10 ble connection goes to "active"
You should now see data coming in in the grafana dashboard that you created before under ip:3000
This diff is collapsed.
---
title: IAQ with Grafana
---
- Prepare raspberry pi
- Login
- `passwd`
- Configure any network interfaces as needed
- `sudo apt update`
- `sudo apt upgrade`
- `sudo reboot`
- `sudo apt install git`
- Install IOTstack
- `git clone https://github.com/SensorsIot/IOTstack.git IOTstack`
- `cd ~/IOTstack`
- `./menu.sh`
- Let it install dependencies
- Restart when asked
- Edit `/etc/group` and add `pi` to the `docker` group
- Logout
- Login again, run `menu.sh` again
- Ignore error message because of docker version
- Select "Build Stack"
- Select grafana, influxdb, nodered using space
- Enter nodered menu to build addons list
- Add generic ble to list
- Hit enter
- Go to docker commands
- Select start stack
- Wait for containers being built
- Pair card10 to system
- Run `bluetoothctl`
- `scan on`
- Enter Bluetooth menu on card10
- `pair CA:4D:10:01:FF:64` (replace with MAC that is shown in bluetooth memnu)
- Type `yes`, hit yes on card10
- `disconnect CA:4D:10:01:FF:64`
- `exit`
- Create influx database
- `docker exec -it influxdb influx`
- `create database card10`
- (use card10)
- `create user "nodered" with password 'supersecure'`
- `create user "grafana" with password 'supersecure'`
- `grant all on card10 to nodered`
- `grant all on card10 to grafana`
- Configure grafana
- Go to `<IP of your Raspberry Pi>:3000`
- User `admin, Password `admin`
- Select a new password
- Add new data source influxdb
- Url: `http://influxdb:8086`
- Database: card10
- User: grafana
- Password: supersecure
- Method: GET
- Import [Air-1640540229032.json](Air-1640540229032.json)
- Add card10 in nodered
- Go to `<IP of your Raspberry Pi>:1880`
- Import [card10-iaq-flow.json](card10-iaq-flow.json)
- Change mac of device to CA:4D:10:01:FF:64 (same as above)
- Set user of influxdb to `nodered`
- Set password of influxdb to `supersecure`
- Deploy flow
- Reboot
- Check that card10 BLE connection goes to "Active"
You should now see data coming in in the grafana dashboard that you created before under <IP of your Raspberry Pi>:3000
[
{
"id": "80bdd197.628e3",
"type": "tab",
"label": "card10 - IAQ",
"disabled": false,
"info": ""
},
{
"id": "7b89673.36ec498",
"type": "Generic BLE in",
"z": "80bdd197.628e3",
"name": "",
"genericBle": "4747b82.2030c48",
"useString": false,
"notification": true,
"x": 530,
"y": 240,
"wires": [
[
"7f392681.7d2c4",
"65f9ae64.9e6a5"
]
]
},
{
"id": "60082717.b120b",
"type": "debug",
"z": "80bdd197.628e3",
"name": "",
"active": false,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "payload",
"targetType": "msg",
"statusVal": "",
"statusType": "auto",
"x": 810,
"y": 460,
"wires": []
},
{
"id": "500e363f.e031a8",
"type": "inject",
"z": "80bdd197.628e3",
"name": "Disconnect",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": "",
"topic": "disconnect",
"payload": "",
"payloadType": "date",
"x": 120,
"y": 300,
"wires": [
[
"7b89673.36ec498"
]
]
},
{
"id": "1c319748.0abd51",
"type": "inject",
"z": "80bdd197.628e3",
"name": "Connect",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "60",
"crontab": "",
"once": true,
"onceDelay": "",
"topic": "connect",
"payload": "",
"payloadType": "date",
"x": 120,
"y": 140,
"wires": [
[
"7b89673.36ec498"
]
]
},
{
"id": "f3829282.1b7f2",
"type": "inject",
"z": "80bdd197.628e3",
"name": "Start All Notify Events",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "60",
"crontab": "",
"once": true,
"onceDelay": "2",
"topic": "2a6e,2a6f,2a6d,422302f1234223422342234223422342",
"payload": "{\"notify\":true,\"period\":0}",
"payloadType": "json",
"x": 170,
"y": 220,
"wires": [
[
"7b89673.36ec498"
]
]
},
{
"id": "81f4444e.789ba",
"type": "influxdb out",
"z": "80bdd197.628e3",
"influxdb": "713e33d1.0ab5f4",
"name": "",
"measurement": "air",
"precision": "",
"retentionPolicy": "",
"database": "database",
"precisionV18FluxV20": "ms",
"retentionPolicyV18Flux": "",
"org": "organisation",
"bucket": "bucket",
"x": 920,
"y": 360,
"wires": []
},
{
"id": "7f392681.7d2c4",
"type": "function",
"z": "80bdd197.628e3",
"name": "",
"func": "d = new DataView(new ArrayBuffer(5));\ncharacteristics = msg.payload.characteristics;\n\ntemperature_uuid = \"2a6e\";\nhumidity_uuid = \"2a6f\";\npressure_uuid = \"2a6d\";\niaq_uuid = \"422302f1234223422342234223422342\"\n\n\npayload = {};\n\nif (temperature_uuid in characteristics) {\n data_raw = characteristics[temperature_uuid];\n d.setUint8(0, data_raw[0]);\n d.setUint8(1, data_raw[1]);\n payload[\"temperature\"] = d.getInt16(0, true) / 100;\n}\n\nif (humidity_uuid in characteristics) {\n data_raw = characteristics[humidity_uuid];\n d.setUint8(0, data_raw[0]);\n d.setUint8(1, data_raw[1]);\n payload[\"humidity\"] = d.getUint16(0, true) / 100;\n}\n\nif (pressure_uuid in characteristics) {\n data_raw = characteristics[pressure_uuid];\n d.setUint8(0, data_raw[0]);\n d.setUint8(1, data_raw[1]);\n d.setUint8(2, data_raw[2]);\n d.setUint8(3, data_raw[3]);\n \n payload[\"pressure\"] = d.getInt32(0, true) / 1000;\n}\n\nif (iaq_uuid in characteristics) {\n data_raw = characteristics[iaq_uuid];\n d.setUint8(0, data_raw[0]);\n d.setUint8(1, data_raw[1]);\n d.setUint8(2, data_raw[2]);\n d.setUint8(3, data_raw[3]);\n d.setUint8(4, data_raw[4]);\n \n payload[\"iaq_accuracy\"] = d.getUint8(0);\n payload[\"iaq\"] = d.getUint16(1, true);\n payload[\"co2\"] = d.getUint16(3, true);\n}\n\n\n//node.warn(payload)\n\nreturn {payload: payload};",
"outputs": 1,
"noerr": 0,
"initialize": "// Code added here will be run once\n// whenever the node is deployed.\n\nlast_humidity = 0\nlast_temperature = 0",
"finalize": "",
"x": 560,
"y": 380,
"wires": [
[
"60082717.b120b",
"81f4444e.789ba"
]
]
},
{
"id": "65f9ae64.9e6a5",
"type": "debug",
"z": "80bdd197.628e3",
"name": "",
"active": false,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "payload.characteristics",
"targetType": "msg",
"statusVal": "",
"statusType": "auto",
"x": 850,
"y": 140,
"wires": []
},
{
"id": "d9d9d6ec.5d3038",
"type": "inject",
"z": "80bdd197.628e3",
"d": true,
"name": "Start Temperature Notify Events",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": "2",
"topic": "2a6e",
"payload": "{\"notify\":true,\"period\":0}",
"payloadType": "json",
"x": 190,
"y": 380,
"wires": [
[
"7b89673.36ec498"
]
]
},
{
"id": "4747b82.2030c48",
"type": "Generic BLE",
"localName": "card10",
"address": "ca:4d:10:01:ff:64",
"uuid": "ca4d1001ff64",
"characteristics": []
},
{
"id": "713e33d1.0ab5f4",
"type": "influxdb",
"hostname": "influxdb",
"port": "8086",
"protocol": "http",
"database": "card10",
"name": "",
"usetls": false,
"tls": "",
"influxdbVersion": "1.x",
"url": "http://localhost:8086",
"rejectUnauthorized": true
}
]
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment