I am using Raspberry 4 to run Node-Red, Influxdb and Grafana.
The Pi is set up on Johannasburg South Africa time zone.
The problem if I query the data are a few hours off, I suspect somehow the data are stored with the incorrect time stamp.
Any one have an idea where to look for how this happens?
Using a test flow in Node-Red
[
{
"id": "1bc44ad459ce827a",
"type": "debug",
"z": "639ef7b5796c2a80",
"name": "debug 2",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"statusVal": "",
"statusType": "auto",
"x": 900,
"y": 900,
"wires": []
},
{
"id": "6d62d916ff2d2685",
"type": "inject",
"z": "639ef7b5796c2a80",
"name": "",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "10",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "",
"payloadType": "date",
"x": 290,
"y": 940,
"wires": [
[
"22d1b43de61de6d3"
]
]
},
{
"id": "22d1b43de61de6d3",
"type": "change",
"z": "639ef7b5796c2a80",
"name": "",
"rules": [
{
"t": "set",
"p": "Temperature",
"pt": "global",
"to": "50*$random()",
"tot": "jsonata"
},
{
"t": "set",
"p": "Density",
"pt": "global",
"to": "1000*$random()",
"tot": "jsonata"
},
{
"t": "set",
"p": "timestamp",
"pt": "global",
"to": "",
"tot": "date"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 480,
"y": 940,
"wires": [
[
"04c946e6a479bb97"
]
]
},
{
"id": "04c946e6a479bb97",
"type": "function",
"z": "639ef7b5796c2a80",
"name": "function 2",
"func": "let dens = global.get('Density')\nlet temp = global.get('Temperature')\nlet timestamp = global.get('timestamp')\n\nmsg.payload = {\n \"Temerature\": temp,\n \"Dencity\": dens\n}\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 700,
"y": 940,
"wires": [
[
"1bc44ad459ce827a",
"349f7178fe25791a"
]
]
},
{
"id": "349f7178fe25791a",
"type": "influxdb out",
"z": "639ef7b5796c2a80",
"influxdb": "01d768772babdcd3",
"name": "co2",
"measurement": "sas",
"precision": "",
"retentionPolicy": "",
"database": "database",
"precisionV18FluxV20": "ns",
"retentionPolicyV18Flux": "",
"org": "SOIOT",
"bucket": "temp",
"x": 890,
"y": 940,
"wires": []
},
{
"id": "01d768772babdcd3",
"type": "influxdb",
"hostname": "127.0.0.1",
"port": "8086",
"protocol": "http",
"database": "database",
"name": "CO2",
"usetls": false,
"tls": "",
"influxdbVersion": "2.0",
"url": "http://localhost:8086",
"rejectUnauthorized": false
}
]