Hi,
I'm streaming video through a template, but because I'm limited to the amount of streaming, I decided to control it with a switch.
When the switch is ON, the video is streaming otherwise, not. The switch turns OFF automatically after a period of 10 seconds, but not the template widget.
I just don't know how to stop streaming. The enable option in the template just greys it, but nothing else.
So, my question is, how can I block the widget from streaming?
TIA
[
{
"id": "6933f86e.a4a8f",
"type": "ui_template",
"z": "80a6d81ce6b76e0a",
"group": "a35b2905.c83aa8",
"name": "Camera",
"order": 1,
"width": "6",
"height": "6",
"format": "<!-- <div>\n <img src=\"http://192.168.1.120:5000/html/min.php\" height=\"300\" width=\"300\"> \n</div> \n<iframe scrolling=no marginwidth=0 marginheight=0 frameborder=0 height=300 width=300 src=\"http://192.168.1.120:5000/html/min.php\"></iframe>\n-->\n{{payload}}",
"storeOutMessages": false,
"fwdInMessages": true,
"resendOnRefresh": false,
"templateScope": "local",
"className": "",
"x": 1060,
"y": 200,
"wires": [
[]
]
},
{
"id": "3381048c6f112247",
"type": "ui_switch",
"z": "80a6d81ce6b76e0a",
"name": "Cam ON/OFF",
"label": "{{msg.label}}",
"tooltip": "",
"group": "a35b2905.c83aa8",
"order": 3,
"width": "5",
"height": 1,
"passthru": true,
"decouple": "false",
"topic": "",
"topicType": "str",
"style": "",
"onvalue": "true",
"onvalueType": "bool",
"onicon": "",
"oncolor": "",
"offvalue": "false",
"offvalueType": "bool",
"officon": "",
"offcolor": "",
"animate": true,
"className": "",
"x": 760,
"y": 260,
"wires": [
[
"0b8be1f3c6abb021",
"f65f56261d3dd123"
]
]
},
{
"id": "f65f56261d3dd123",
"type": "function",
"z": "80a6d81ce6b76e0a",
"name": "Enable Camera",
"func": "if (msg.payload === true){\n msg.payload = '<iframe scrolling=no marginwidth=0 marginheight=0 frameborder=0 height=300 width=300 src=\"http://192.168.1.120:5000/html/min.php\"></iframe>';\n}\nelse\n{\n msg.payload = '<iframe scrolling=no marginwidth=0 marginheight=0 frameborder=0 height=300 width=300 src=\"\"></iframe>';\n}\nreturn msg;\n",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 1000,
"y": 260,
"wires": [
[
"6933f86e.a4a8f"
]
]
},
{
"id": "67cd9c7cf5b4a0d6",
"type": "inject",
"z": "80a6d81ce6b76e0a",
"name": "Set at start",
"props": [
{
"p": "set",
"v": "false",
"vt": "bool"
},
{
"p": "label",
"v": "Cam OFF",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": true,
"onceDelay": "1",
"topic": "",
"x": 750,
"y": 180,
"wires": [
[
"3381048c6f112247"
]
]
},
{
"id": "0b8be1f3c6abb021",
"type": "trigger",
"z": "80a6d81ce6b76e0a",
"name": "",
"op1": "true",
"op2": "false",
"op1type": "bool",
"op2type": "bool",
"duration": "10",
"extend": false,
"overrideDelay": false,
"units": "s",
"reset": "false",
"bytopic": "all",
"topic": "topic",
"outputs": 1,
"x": 790,
"y": 360,
"wires": [
[
"3381048c6f112247",
"87b89d385b8e497d"
]
]
},
{
"id": "87b89d385b8e497d",
"type": "function",
"z": "80a6d81ce6b76e0a",
"name": "",
"func": "if(msg.payload === false){\n msg.label = \"Cam OFF\";\n msg.payload = false;\n}\nelse{\n msg.label = \"Cam ON\";\n msg.payload = true;\n}\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 980,
"y": 360,
"wires": [
[
"3381048c6f112247"
]
]
},
{
"id": "a35b2905.c83aa8",
"type": "ui_group",
"name": "Camera",
"tab": "fcae68a61b2b76db",
"order": 4,
"disp": true,
"width": "6",
"collapse": true
},
{
"id": "fcae68a61b2b76db",
"type": "ui_tab",
"name": "DEMO",
"icon": "dashboard",
"order": 1,
"disabled": false,
"hidden": false
}
]