flow: update stream address to local IP of machine

This commit is contained in:
Romain Bazile 2021-10-28 15:23:10 +02:00
parent 62c72e69ac
commit 8dbb3e433d

View file

@ -1615,12 +1615,12 @@
"order": 1, "order": 1,
"width": 18, "width": 18,
"height": 14, "height": 14,
"format": "<center>\n <img src=\"http://planktoscope.local:8000/stream.mjpg\"\n width=\"100%\" height=\"100%\">\n</center>", "format": "<span ng-bind-html=\"msg.payload\"></span>",
"storeOutMessages": true, "storeOutMessages": true,
"fwdInMessages": true, "fwdInMessages": true,
"resendOnRefresh": false, "resendOnRefresh": false,
"templateScope": "local", "templateScope": "local",
"x": 130, "x": 610,
"y": 40, "y": 40,
"wires": [ "wires": [
[] []
@ -2495,12 +2495,12 @@
"order": 1, "order": 1,
"width": 10, "width": 10,
"height": 8, "height": 8,
"format": "<center>\n <img src=\"http://planktoscope.local:8000/stream.mjpg\"\n width=\"100%\" height=\"100%\">\n</center>", "format": "<span ng-bind-html=\"msg.payload\"></span>",
"storeOutMessages": true, "storeOutMessages": true,
"fwdInMessages": true, "fwdInMessages": true,
"resendOnRefresh": false, "resendOnRefresh": false,
"templateScope": "local", "templateScope": "local",
"x": 910, "x": 550,
"y": 40, "y": 40,
"wires": [ "wires": [
[] []
@ -5295,16 +5295,18 @@
"type": "function", "type": "function",
"z": "f21ba04.c26266", "z": "f21ba04.c26266",
"name": "parse IP Info", "name": "parse IP Info",
"func": "if (msg.payload === null){\n var ip = \"\";\n var mask = \"\";\n var broadcast = \"\";\n}\nelse{\n var ip = msg.payload.match(/inet ([0-9\\.]+)/)[1];\n var mask = msg.payload.match(/netmask ([0-9\\.]+)/)[1];\n var broadcast = msg.payload.match(/broadcast ([0-9\\.]+)/)[1];\n}\n\nreturn [{topic: 'ip', payload: ip},{topic: 'mask', payload: mask},{topic: 'broadcast', payload: broadcast}]", "func": "var ip = \"planktoscope.local\";\nvar mask = \"\";\nvar broadcast = \"\";\n\nif (msg.payload !== null){\n ip = msg.payload.match(/inet ([0-9\\.]+)/)[1];\n mask = msg.payload.match(/netmask ([0-9\\.]+)/)[1];\n broadcast = msg.payload.match(/broadcast ([0-9\\.]+)/)[1];\n}\n\nreturn [{topic: 'ip', payload: ip},{topic: 'mask', payload: mask},{topic: 'broadcast', payload: broadcast}]",
"outputs": 3, "outputs": 3,
"noerr": 0, "noerr": 0,
"initialize": "", "initialize": "",
"finalize": "", "finalize": "",
"libs": [],
"x": 730, "x": 730,
"y": 180, "y": 180,
"wires": [ "wires": [
[ [
"d71c8185.800fd" "d71c8185.800fd",
"49111a72f4e32740"
], ],
[ [
"67d052ba.99ff24" "67d052ba.99ff24"
@ -5331,8 +5333,8 @@
"label": "IP", "label": "IP",
"format": "{{msg.payload || '---'}}", "format": "{{msg.payload || '---'}}",
"layout": "row-spread", "layout": "row-spread",
"x": 990, "x": 930,
"y": 141, "y": 140,
"wires": [] "wires": []
}, },
{ {
@ -5347,8 +5349,8 @@
"label": "Netmask", "label": "Netmask",
"format": "{{msg.payload || '---'}}", "format": "{{msg.payload || '---'}}",
"layout": "row-spread", "layout": "row-spread",
"x": 1000, "x": 940,
"y": 181, "y": 180,
"wires": [] "wires": []
}, },
{ {
@ -5363,8 +5365,8 @@
"label": "Broadcast", "label": "Broadcast",
"format": "{{msg.payload || '---'}}", "format": "{{msg.payload || '---'}}",
"layout": "row-spread", "layout": "row-spread",
"x": 1010, "x": 950,
"y": 220, "y": 219,
"wires": [] "wires": []
}, },
{ {
@ -5460,8 +5462,8 @@
"label": "SSID", "label": "SSID",
"format": "{{msg.payload || '---'}}", "format": "{{msg.payload || '---'}}",
"layout": "row-spread", "layout": "row-spread",
"x": 990, "x": 930,
"y": 260, "y": 259,
"wires": [] "wires": []
}, },
{ {
@ -10802,5 +10804,88 @@
"wires": [ "wires": [
[] []
] ]
},
{
"id": "49111a72f4e32740",
"type": "link out",
"z": "f21ba04.c26266",
"name": "IP",
"links": [
"142bc61a0bde1ba9",
"c515edcd8681c244"
],
"x": 1035,
"y": 160,
"wires": []
},
{
"id": "142bc61a0bde1ba9",
"type": "link in",
"z": "bccd1f23.87219",
"name": "Cam Stream",
"links": [
"49111a72f4e32740"
],
"x": 235,
"y": 40,
"wires": [
[
"3ca8be38ddb269e9"
]
]
},
{
"id": "3ca8be38ddb269e9",
"type": "template",
"z": "bccd1f23.87219",
"name": "Prepare stream HTML",
"field": "payload",
"fieldType": "msg",
"format": "handlebars",
"syntax": "mustache",
"template": "<center>\n <img src=\"http://{{payload}}:8000/stream.mjpg\"\n onerror=\"this.onerror=null; this.src='http://{{payload}}:80/error.svg'\"\n alt=\"If you see this, there probably is an error either with your camera or with the python service. Please restart your machine.\"\n width=\"100%\" height=\"100%\">\n</center>",
"output": "str",
"x": 380,
"y": 40,
"wires": [
[
"6a84252a.d52a0c"
]
]
},
{
"id": "c515edcd8681c244",
"type": "link in",
"z": "baa1e3d9.cb29d",
"name": "Cam Stream",
"links": [
"49111a72f4e32740"
],
"x": 195,
"y": 40,
"wires": [
[
"a77625dc21c8a3cc"
]
]
},
{
"id": "a77625dc21c8a3cc",
"type": "template",
"z": "baa1e3d9.cb29d",
"name": "Prepare stream HTML",
"field": "payload",
"fieldType": "msg",
"format": "handlebars",
"syntax": "mustache",
"template": "<center>\n <img src=\"http://{{payload}}:8000/stream.mjpg\"\n onerror=\"this.onerror=null; this.src='http://{{payload}}:80/error.svg'\"\n alt=\"If you see this, there probably is an error either with your camera or with the python service. Please restart your machine.\"\n width=\"100%\" height=\"100%\">\n</center>",
"output": "str",
"x": 340,
"y": 40,
"wires": [
[
"bb2bb7ce.1d1458"
]
]
} }
] ]