2017-11-14, 10:03 PM
Anyone else recording data? For a while now I've been saving various bits to sqlite. Seems to be one of the easiest plus the database is just one file so you can copy it across to another machine to play with. Pus there's a PHP webpage available which makes it easy to go in and set up or just have a look
Little bit of node red if anyone is inerested -
I tried influxdb with grafana which was really good with lots of plotting options but just too big and hogged too much resources so that had to go.
What isn't going so well with sqlite is plotting - any one know of any python or PHP that would fit the bill? My programming skills aren't that far ahead of hello world
What would be fantastic would be to plot a days battery voltage over voltage from a week or month before to see if there's much difference and maybe get a bit of notice if they aren't so well. Already just seeing how quick the engine warms up and things like that has been really interesting.
Such a powerful tool, a little Pi, openplotter and node red - systems into the thousands can't do a load of things which it can.
Ta
Little bit of node red if anyone is inerested -
Code:
[
{
"id": "ab86fbfb.82f1c8",
"type": "switch",
"z": "f1a0cb4.fe86138",
"name": "Is it eng data?",
"property": "msg.payload.updates.values.path",
"propertyType": "jsonata",
"rules": [
{
"t": "cont",
"v": "propulsion",
"vt": "str"
}
],
"checkall": "false",
"outputs": 1,
"x": 180,
"y": 240,
"wires": [
[
"aaed95ff.c274e8"
]
]
},
{
"id": "aaed95ff.c274e8",
"type": "change",
"z": "f1a0cb4.fe86138",
"name": "create msg.eng etc",
"rules": [
{
"t": "set",
"p": "eng",
"pt": "msg",
"to": "msg.payload.updates.values[path=\"propulsion.engine.temperature\"].$number(value)-273.15",
"tot": "jsonata"
},
{
"t": "set",
"p": "alt",
"pt": "msg",
"to": "msg.payload.updates.values[path=\"propulsion.alt.temperature\"].$number(value)-273.15",
"tot": "jsonata"
},
{
"t": "set",
"p": "exh",
"pt": "msg",
"to": "msg.payload.updates.values[path=\"propulsion.exh.temperature\"].$number(value)-273.15",
"tot": "jsonata"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 190,
"y": 280,
"wires": [
[
"7a2b1aa3.f272f4"
]
]
},
{
"id": "7a2b1aa3.f272f4",
"type": "function",
"z": "f1a0cb4.fe86138",
"name": "create INSERT topic eng",
"func": "// set flow variables to signalk data\nif (msg.eng !==undefined) {var eng = flow.set(\"eng\", msg.eng.toFixed(1));\n //msg.topic= \"INSERT INTO engine (eng) VALUES (\" + flow.get(\"eng\") + \" );\" ;\n}\nif (msg.alt !==undefined) {var alt = flow.set(\"alt\", msg.alt.toFixed(1));\n //msg.topic= \"INSERT INTO engine (alt) VALUES (\" + flow.get(\"alt\") + \" );\" ;\n}\nif (msg.exh !==undefined) {var exh = flow.set(\"exh\", msg.exh.toFixed(1));\n //msg.topic= \"INSERT INTO engine (exh) VALUES (\" + flow.get(\"exh\") + \" );\" ;\n}\n\n// create sqlite insert commend\nmsg.topic= \"INSERT INTO engine (eng, alt, exh) VALUES (\" + flow.get(\"eng\") + \",\" + flow.get(\"alt\") + \",\" + flow.get(\"exh\") + \" );\" ;\n//msg.topic= \"INSERT INTO engine (eng) VALUES (\" + flow.get(\"eng\") + \" );\" ;\nreturn msg;\n ",
"outputs": "1",
"noerr": 0,
"x": 430,
"y": 260,
"wires": [
[
"c8b0c6b1.e1b078",
"dc2bd84f.dcb9a8"
]
]
},
{
"id": "c8b0c6b1.e1b078",
"type": "delay",
"z": "f1a0cb4.fe86138",
"name": "",
"pauseType": "rate",
"timeout": "5",
"timeoutUnits": "seconds",
"rate": "1",
"nbRateUnits": "1",
"rateUnits": "minute",
"randomFirst": "1",
"randomLast": "5",
"randomUnits": "seconds",
"drop": true,
"x": 430,
"y": 300,
"wires": [
[
"8d7a3b1d.824788"
]
]
},
{
"id": "8d7a3b1d.824788",
"type": "sqlite",
"z": "f1a0cb4.fe86138",
"mydb": "fe279cd9.bbe82",
"name": "",
"x": 690,
"y": 300,
"wires": [
[]
]
},
{
"id": "fe279cd9.bbe82",
"type": "sqlitedb",
"z": "",
"db": "/home/pi/database/boatdata.db"
}
]
What isn't going so well with sqlite is plotting - any one know of any python or PHP that would fit the bill? My programming skills aren't that far ahead of hello world


Such a powerful tool, a little Pi, openplotter and node red - systems into the thousands can't do a load of things which it can.
Ta