(2017-11-17, 02:35 PM)tocan Wrote: Its nice you found yours solution but i am no more interest in sql database logging. That this is working i did publish in my blog . What i am interesting for is something you did drop for. i am interesting in a step by step guide of yours influx db logging with grafana including the connection to Signal K. There is no reason i think to hide what you did drop. Exact this work i am interesting for.
Grafa was populated through node-red.
Similar to this for sqlite -
Code:
[
{
"id": "67b79641.1fad68",
"type": "websocket in",
"z": "749e8283.293f4c",
"name": "SignalK input",
"server": "fc1b2b62.0b63a8",
"client": "",
"x": 90,
"y": 120,
"wires": [
[
"20af45d9.7fe30a",
"abc25a09.833898"
]
]
},
{
"id": "abc25a09.833898",
"type": "switch",
"z": "749e8283.293f4c",
"name": "Is it nav data?",
"property": "msg.payload.updates.source.sentence",
"propertyType": "jsonata",
"rules": [
{
"t": "eq",
"v": "RMC",
"vt": "str"
}
],
"checkall": "false",
"outputs": 1,
"x": 500,
"y": 60,
"wires": [
[
"4c17ab8.141a354"
]
]
},
{
"id": "4c17ab8.141a354",
"type": "change",
"z": "749e8283.293f4c",
"name": "create COG, SOG etc",
"rules": [
{
"t": "set",
"p": "SOG",
"pt": "msg",
"to": "msg.payload.updates.values[path=\"navigation.speedOverGround\"].value*1.94384",
"tot": "jsonata"
},
{
"t": "set",
"p": "COG",
"pt": "msg",
"to": "msg.payload.updates.values[path=\"navigation.courseOverGroundTrue\"].value*180/3.14",
"tot": "jsonata"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 520,
"y": 100,
"wires": [
[
"23641279.19f17e"
]
]
},
{
"id": "23641279.19f17e",
"type": "function",
"z": "749e8283.293f4c",
"name": "create INSERT topic SOG, COG",
"func": "\n msg.SOG=msg.SOG.toFixed(1);\n msg.COG=msg.COG.toFixed(1);\n msg.topic = \"INSERT INTO navdata (SOG, COG) VALUES (\" + msg.SOG + \",\" + msg.COG + \" );\";\n \n return msg;",
"outputs": "1",
"noerr": 0,
"x": 750,
"y": 60,
"wires": [
[
"8e3e8329.9202f"
]
]
},
{
"id": "8e3e8329.9202f",
"type": "delay",
"z": "749e8283.293f4c",
"name": "",
"pauseType": "rate",
"timeout": "5",
"timeoutUnits": "seconds",
"rate": "1",
"nbRateUnits": "1",
"rateUnits": "minute",
"randomFirst": "1",
"randomLast": "5",
"randomUnits": "seconds",
"drop": true,
"x": 710,
"y": 100,
"wires": [
[
"a2715992.38a2d8"
]
]
},
{
"id": "a2715992.38a2d8",
"type": "sqlite",
"z": "749e8283.293f4c",
"mydb": "fe279cd9.bbe82",
"name": "",
"x": 1030,
"y": 100,
"wires": [
[]
]
},
{
"id": "fc1b2b62.0b63a8",
"type": "websocket-listener",
"z": "",
"path": "ws://localhost:3000/signalk/v1/stream",
"wholemsg": "false"
},
{
"id": "fe279cd9.bbe82",
"type": "sqlitedb",
"z": "",
"db": "/home/pi/database/boatdata.db"
}
]
This one might be of use as well, simply saving AIS to a text file -
Code:
[
{
"id": "36d7cef4.ce9742",
"type": "tcp in",
"z": "f1a0cb4.fe86138",
"name": "",
"server": "client",
"host": "10.10.10.1",
"port": "10109",
"datamode": "stream",
"datatype": "utf8",
"newline": "\\n",
"topic": "",
"base64": false,
"x": 184.00001525878906,
"y": 83,
"wires": [
[
"2ec38e6f.de4e32"
]
]
},
{
"id": "2ec38e6f.de4e32",
"type": "switch",
"z": "f1a0cb4.fe86138",
"name": "Filter just ais",
"property": "payload",
"propertyType": "msg",
"rules": [
{
"t": "regex",
"v": "!AIVDM*",
"vt": "str",
"case": true
}
],
"checkall": "true",
"outputs": 1,
"x": 412,
"y": 68.99998474121094,
"wires": [
[
"b94ee7ad.e95078"
]
]
},
{
"id": "b94ee7ad.e95078",
"type": "file",
"z": "f1a0cb4.fe86138",
"name": "",
"filename": "/home/pi/savedais2.txt",
"appendNewline": true,
"createDir": false,
"overwriteFile": "false",
"x": 624,
"y": 45.99998474121094,
"wires": []
}
]