-
Notifications
You must be signed in to change notification settings - Fork 1
/
SignalK_websocket_stream.json
1 lines (1 loc) · 6.98 KB
/
SignalK_websocket_stream.json
1
[{"id":"b818f657.030558","type":"tab","label":"Signalk_websocket_stream","disabled":false,"info":""},{"id":"f700c03a.2cbbe","type":"websocket in","z":"b818f657.030558","name":"WEB socket in","server":"84dc11b1.16aa4","client":"","x":100,"y":100,"wires":[["e0032c23.f2596"]]},{"id":"e0032c23.f2596","type":"json","z":"b818f657.030558","name":"","property":"payload","action":"obj","pretty":false,"x":350,"y":100,"wires":[["e6b64075.4ca59"]]},{"id":"a8fd07b3.95257","type":"function","z":"b818f657.030558","name":"WEB-socket subscribe","func":"// Start with unsubscribe, clear old stuff\n\nmsg.payload =\n {\n \"context\": \"*\",\n \"unsubscribe\": [\n {\"path\": \"*\"}\n ]\n }\n\nnode.send(msg);\n\n// Subscribe\n\nmsg.payload =\n{\n \"context\": \"vessels.self\",\n \"subscribe\": [\n {\n \"path\": \"environment.depth.belowTransducer\",\n \"period\": 1000,\n \"policy\": \"fixed\"\n },\n {\n \"path\": \"navigation.speedOverGround\",\n \"period\": 1000,\n \"policy\": \"fixed\"\n }\n ]\n}\n\nnode.send(msg);\n\nnode.done();\n\nreturn ;\n\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":300,"y":40,"wires":[["699a9031.f55db"]]},{"id":"50ef850.acb597c","type":"inject","z":"b818f657.030558","name":"Initialize","props":[{"p":"payload","v":"","vt":"date"},{"p":"topic","v":"","vt":"string"}],"repeat":"","crontab":"","once":true,"onceDelay":"60","topic":"","payload":"","payloadType":"date","x":100,"y":40,"wires":[["a8fd07b3.95257"]]},{"id":"e6b64075.4ca59","type":"function","z":"b818f657.030558","name":"Get the data","func":"const kelvinOffset = 273.15;\nconst msToKnot = 1.9438444924406\n\nvar depthBT = {}; // depth Below Transducer\nvar speedOG = {}; // speed Over Ground\n\nswitch(msg.payload.updates[0].values[0].path) {\n \n\tcase \"environment.depth.belowTransducer\" :\n\t\tdepthBT.payload = msg.payload.updates[0].values[0].value;\n\t\tdepthBT.topic = \"Depth below Transducer\"\n\t\tnode.send([depthBT, null]);\n\t\tbreak;\n\t\n\tcase \"navigation.speedOverGround\" :\n\t\tspeedOG.payload = (msg.payload.updates[0].values[0].value * msToKnot).toFixed(1);\n\t\tspeedOG.topic = \"Speed over ground\"\n\t\tnode.send([null, speedOG]);\n\t\tbreak;\n\t\t\n\tdefault:\n\t\tnode.send([null, null]);\n}\n\nnode.done();\n\nreturn;\n","outputs":2,"noerr":0,"initialize":"","finalize":"","x":270,"y":180,"wires":[["9d0fe449.8db75","1da32794.2f4688"],["77d1f4d5.9e5b9c","c1bdb68.ffb8dc8"]]},{"id":"9d0fe449.8db75","type":"ui_chart","z":"b818f657.030558","name":"","group":"791f4ef7.c797d","order":1,"width":"0","height":"0","label":"Depth","chartType":"line","legend":"false","xformat":"HH:mm:ss","interpolate":"linear","nodata":"","dot":false,"ymin":"","ymax":"","removeOlder":1,"removeOlderPoints":"","removeOlderUnit":"3600","cutout":0,"useOneColor":false,"useUTC":false,"colors":["#1f77b4","#aec7e8","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"useOldStyle":false,"outputs":1,"x":770,"y":120,"wires":[[]]},{"id":"77d1f4d5.9e5b9c","type":"ui_chart","z":"b818f657.030558","name":"","group":"791f4ef7.c797d","order":2,"width":"0","height":"0","label":"Speed","chartType":"line","legend":"false","xformat":"HH:mm:ss","interpolate":"linear","nodata":"","dot":false,"ymin":"","ymax":"","removeOlder":1,"removeOlderPoints":"","removeOlderUnit":"3600","cutout":0,"useOneColor":false,"useUTC":false,"colors":["#1f77b4","#aec7e8","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"useOldStyle":false,"outputs":1,"x":770,"y":200,"wires":[[]]},{"id":"699a9031.f55db","type":"websocket out","z":"b818f657.030558","name":"WS out","server":"84dc11b1.16aa4","client":"","x":500,"y":40,"wires":[]},{"id":"1da32794.2f4688","type":"ui_gauge","z":"b818f657.030558","name":"","group":"f128a98e.0b3158","order":1,"width":"4","height":"4","gtype":"gage","title":"Depth","label":"m","format":"{{value}}","min":0,"max":"40","colors":["#ca3838","#e6e600","#00b500"],"seg1":"3","seg2":"7","x":650,"y":100,"wires":[]},{"id":"c1bdb68.ffb8dc8","type":"ui_gauge","z":"b818f657.030558","name":"","group":"f128a98e.0b3158","order":2,"width":"0","height":"0","gtype":"gage","title":"Speed","label":"knot","format":"{{value}}","min":0,"max":"30","colors":["#00b500","#e6e600","#00b500"],"seg1":"8","seg2":"18","x":650,"y":160,"wires":[]},{"id":"53976fab.cbb898","type":"comment","z":"b818f657.030558","name":"Col 1","info":"","x":650,"y":40,"wires":[]},{"id":"90ffa7b3.077f7","type":"comment","z":"b818f657.030558","name":"Col 2","info":"","x":770,"y":40,"wires":[]},{"id":"ddef688b.7b36f8","type":"signalk-subscribe","z":"b818f657.030558","name":"Subscribe, Position","mode":"sendAll","flatten":true,"context":"vessels.self","path":"navigation.position","source":"","period":1000,"x":110,"y":240,"wires":[["246531d4.4af98e"]]},{"id":"b0cab551.d15c28","type":"ui_text","z":"b818f657.030558","group":"f128a98e.0b3158","order":3,"width":"4","height":"3","name":"","label":"Position","format":"{{msg.payload}}","layout":"col-center","x":660,"y":240,"wires":[]},{"id":"246531d4.4af98e","type":"function","z":"b818f657.030558","name":"","func":"// Put the cordinates in a html table\n\nmsg.payload = \"<table> <tr> <td>Long.</td> <td>\"+ msg.payload.longitude + \" </td> </tr> <tr> <td>Lat.</td> <td>\"+ msg.payload.latitude + \"</td> </tr></table> \";\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":320,"y":240,"wires":[["b0cab551.d15c28"]]},{"id":"6b2ec654.593878","type":"signalk-subscribe","z":"b818f657.030558","name":"Subscribe, wind speed","mode":"sendAll","flatten":true,"context":"vessels.self","path":"environment.wind.speedApparent","source":"","period":1000,"x":120,"y":300,"wires":[["8eceb353.f070b"]]},{"id":"814f7cf6.2d2aa8","type":"ui_template","z":"b818f657.030558","group":"791f4ef7.c797d","name":"Apparent wind","order":3,"width":"0","height":"0","format":"<html>\n<head>\n<style>\nh1 {text-align: center;}\np {text-align: center;}\ndiv {text-align: center;}\n</style>\n</head>\n<body>\n\n<br/>\n\n<p>Apparent windspeed</p>\n<b>\n <div ng-bind-html=\"msg.payload\"></div>\n</b>\n\n<br/>\n\n</body>\n</html>","storeOutMessages":true,"fwdInMessages":true,"resendOnRefresh":true,"templateScope":"local","x":680,"y":300,"wires":[[]]},{"id":"8eceb353.f070b","type":"function","z":"b818f657.030558","name":"","func":"let appWind = msg.payload + \" m/s\"\nmsg.payload = appWind\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":360,"y":300,"wires":[["814f7cf6.2d2aa8"]]},{"id":"84dc11b1.16aa4","type":"websocket-listener","z":"","path":"ws://op:3000/signalk/v1/stream?subscribe=none","wholemsg":"false"},{"id":"791f4ef7.c797d","type":"ui_group","z":"","name":"Group 2","tab":"1c60c0a7.6756e7","order":2,"disp":false,"width":"6","collapse":false},{"id":"f128a98e.0b3158","type":"ui_group","z":"","name":"Group 1","tab":"1c60c0a7.6756e7","order":1,"disp":false,"width":"4","collapse":false},{"id":"1c60c0a7.6756e7","type":"ui_tab","z":"","name":"Boat Data","icon":"dashboard","order":3,"disabled":false,"hidden":false}]