Hi Colin,
thanks for the reply. I do not use partial deploy (at least, I don't think so). I initialize the flow at start with an inject and the template function feeds the template dashboard at start.
As said, sometimes it works perfectly: it deplois, I see the html page, it works as inteded, and then it just disappears, to appears again. I do not think is a problem of initialization. It looks to me that there is something - maybe in the code - that nodered has problem with.
Here below the code of one of the example I have problem with. I have other example in case.
[
{
"id": "680451a6c59fdfab",
"type": "inject",
"z": "db9e5b42ac35bf8b",
"name": "",
"props": [
{
"p": "areas",
"v": "[{\"name\":\"area1\",\"water\":\"r1_oo1\",\"fire\":\"r1_oo2\",\"hv\":[\"r1_hv1\",\"r1_hv2\"],\"pr\":[\"r1_pr1\",\"r1_pr2\"],\"dw\":[\"r1_dw1\",\"r1_dw2\"]},{\"name\":\"area2\",\"water\":\"r2_oo1\",\"fire\":\"r2_oo2\",\"hv\":[\"r2_hv1\"],\"pr\":[\"r2_pr1\"]},{\"name\":\"area3\",\"water\":\"r3_oo1\",\"fire\":\"r3_oo2\",\"hv\":[\"r3_hv1\",\"r3_hv2\",\"r3_hv3\",\"r3_hv4\"],\"pr\":[\"r3_pr1\",\"r3_pr2\",\"r3_pr3\",\"r3_pr4\"]}]",
"vt": "json"
}
],
"repeat": "",
"crontab": "",
"once": true,
"onceDelay": 0.1,
"topic": "",
"x": 490,
"y": 300,
"wires": [
[
"6778dc619fed5a9a"
]
]
},
{
"id": "6778dc619fed5a9a",
"type": "template",
"z": "db9e5b42ac35bf8b",
"name": "",
"field": "template",
"fieldType": "msg",
"format": "handlebars",
"syntax": "mustache",
"template": "<style>\n\n</style>\n\n<script>\n(function(scope){ \n\n let oo_status = {}\n\n scope.$watch('msg', function(msg) {\n // Force repaint to adjust to table height\n if (msg) {\n $(\"#root\").parent().css(\"height\",\"\");\n }\n\n // change oo status\n if (msg.sensor_type == \"oo\")\n oo_status[msg.sensor_name] = msg.payload\n\n // change color\n if (msg.sensor_name)\n $(\"#\"+msg.sensor_name).css(\"color\", msg.payload?\"green\":\"red\");\n\n });\n\n // pr: payload/state/presence\n // dw: payload/state/open\n // hv: payload/config/\n\n $(\".sensor_oo\").click(function() {\n let id=$(this).attr(\"id\");\n oo_status[id] = !oo_status[id]\n $(\"#\"+id).css(\"color\", oo_status[id]?\"green\":\"red\");\n scope.send({\n topic: \"bahf/sensor/\"+id+\"/api/raw/set/onoff/req/1234\",\n payload:oo_status[id]\n });\n console.log(oo_status)\n });\n\n})(scope);\n</script>\n\n<body>\n<table style=\"width:100%; text-align:left\">\n <tbody>\n {{#areas}}\n <tr>\n <td style=\"width:20%\" title=\"name\">\n <span style=\"margin-top: 5px;\">{{name}}</span>\n </td>\n <td style=\"width:20%\" title=\"oo\">\n {{#water}}\n <span id=\"{{water}}\" class=\"sensor_oo\"><i class=\"fa fa-shower\"></i></span>\n {{/water}}\n {{#fire}}\n <span id=\"{{fire}}\" class=\"sensor_oo\"><i class=\"fa fa-fire\"></i></span>\n {{/fire}}\n </td> \n <td style=\"width:20%\" title=\"hv\">\n {{#hv}}\n <span id=\"{{.}}\" class=\"sensor_hv\"><i class=\"fa fa-circle \"></i></span>\n {{/hv}}\n </td>\n <td style=\"width:20%\" title=\"pr\">\n {{#pr}}\n <span id=\"{{.}}\" class=\"sensor_pr\"><i class=\"fa fa-user \"></i></span>\n {{/pr}}\n </td>\n <td style=\"width:20%\" title=\"dw\">\n {{#dw}}\n <span id=\"{{.}}\" class=\"sensor_dw\"><i class=\"material-icons\">content_copy</i></span>\n {{/dw}}\n </td>\n </tr>\n {{/areas}}\n </tbody>\n</table>\n</body>",
"output": "str",
"x": 640,
"y": 380,
"wires": [
[
"c921ab5572becb08"
]
],
"info": "<table style=\"width:100%\">\r\n <tbody>\r\n <tr>\r\n <td style=\"width:25%; text-align:left\">\r\narea1\r\n</td>\r\n <td style=\"width:25%; text-align:left\">\r\n <table style=\"width:100%\">\r\n <tbody>\r\n <tr>\r\n <td style=\"text-align:left\">\r\n OO1\r\n </td>\r\n <td style=\"text-align:left\">\r\n OO2\r\n </td>\r\n </tr>\r\n </tbody>\r\n </table>\r\n </td>\r\n <td style=\"width:25%; text-align:left\">\r\n <table>\r\n <tbody>\r\n <tr>\r\n <td style=\"text-align:center\">\r\n HV1\r\n </td>\r\n <td style=\"text-align:center\">\r\n HV2\r\n </td>\r\n <td style=\"text-align:center\">\r\n HV3\r\n </td>\r\n <td style=\"text-align:center\">\r\n HV4\r\n </td>\r\n\t\t\t\t </tr>\r\n </tbody>\r\n </table>\r\n </td>\r\n <td style=\"width:25%; text-align:left\">\r\n <table>\r\n <tbody>\r\n <tr>\r\n <td style=\"width:25%; text-align:center\">\r\n PR1\r\n </td>\r\n <td style=\"width:25%; text-align:center\">\r\n PR2\r\n </td>\r\n\t\t\t\t </tr>\r\n </tbody>\r\n </table>\r\n </td>\r\n </tr>\r\n </tbody>\r\n</table>"
},
{
"id": "c921ab5572becb08",
"type": "ui_template",
"z": "db9e5b42ac35bf8b",
"group": "65907e78a8611bee",
"name": "template.homepage.area",
"order": 18,
"width": "0",
"height": "0",
"format": "",
"storeOutMessages": true,
"fwdInMessages": false,
"resendOnRefresh": true,
"templateScope": "local",
"x": 950,
"y": 500,
"wires": [
[
"b2638788fb3a1bf4",
"6a96fd66e941f0ab"
]
]
},
{
"id": "65907e78a8611bee",
"type": "ui_group",
"name": "Homepage",
"tab": "4154a19ba5409263",
"order": 1,
"disp": false,
"width": "16",
"collapse": false
},
{
"id": "4154a19ba5409263",
"type": "ui_tab",
"name": "HOMEPAGE",
"icon": "dashboard",
"order": 1,
"disabled": false,
"hidden": false
}
]