Hi
my question, when I get this Error "not allowed" and why sometimes this function works?
the alarm will be generated at the first link the date/time has the same value 3 times "no data/update" and the second link is a Alarm (false/true) "no Battery/charge"
[
{
"id": "637d2bdf.cba3ac",
"type": "function",
"z": "998f3d00.013738",
"name": "Alarm1",
"func": "var timebefore = flow.get('timebefore');\nvar newtime = msg.payload;\nvar count = context.get('count')||0;\n\n//node.warn(\"last time: \" + timebefore);\n//node.warn(\"time aktuell: \" + newtime);\n\nif(newtime === timebefore) {\n count += 1;\n context.set('count',count);\n}\n else {\n count = 0;\n context.set('count',count); \n }\n\nif ( count === 3 ) {\n \n msg.alarm = true;\n count = 0; \n context.set('count',count);\n}\n else {\n msg.alarm = false;\n }\n \nmsg.count = count \ntimebefore=newtime;\nflow.set('timebefore', msg.payload);\nreturn msg;",
"outputs": 1,
"noerr": 0,
"x": 280,
"y": 580,
"wires": [
[
"4b631511.8bd004",
"3daa8f10.ed8258"
]
]
},
{
"id": "3daa8f10.ed8258",
"type": "debug",
"z": "998f3d00.013738",
"name": "",
"active": false,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"x": 470,
"y": 520,
"wires": []
},
{
"id": "34c56514.13ff6a",
"type": "link in",
"z": "998f3d00.013738",
"name": "",
"links": [
"ac421d25.aa4088"
],
"x": 155,
"y": 580,
"wires": [
[
"637d2bdf.cba3ac"
]
]
},
{
"id": "4b631511.8bd004",
"type": "switch",
"z": "998f3d00.013738",
"name": "Meldung",
"property": "alarm",
"propertyType": "msg",
"rules": [
{
"t": "true"
}
],
"checkall": "true",
"repair": false,
"outputs": 1,
"x": 440,
"y": 580,
"wires": [
[
"f9ef1873.a934d8"
]
]
},
{
"id": "b0c8f61c.c78218",
"type": "ui_toast",
"z": "998f3d00.013738",
"position": "dialog",
"displayTime": "3",
"highlight": "",
"sendall": true,
"outputs": 1,
"ok": "OK",
"cancel": "",
"raw": false,
"topic": "",
"name": "WeatherData FAIL",
"x": 830,
"y": 640,
"wires": [
[
"40b60915.6cf19"
]
]
},
{
"id": "2d5fc592.6ab3e2",
"type": "inject",
"z": "998f3d00.013738",
"name": "",
"topic": "",
"payload": "145",
"payloadType": "num",
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"x": 130,
"y": 760,
"wires": [
[]
]
},
{
"id": "4ab9d7d7.3b1c4",
"type": "template",
"z": "998f3d00.013738",
"name": "Alarm1",
"field": "payload",
"fieldType": "msg",
"format": "handlebars",
"syntax": "mustache",
"template": "Attention attention please \nno Data - update\nno Data - update any more",
"output": "str",
"x": 600,
"y": 640,
"wires": [
[
"a36d9476.1c27b8",
"b0c8f61c.c78218"
]
]
},
{
"id": "e9399b1b.2ce83",
"type": "inject",
"z": "998f3d00.013738",
"name": "Test",
"topic": "",
"payload": "Test",
"payloadType": "str",
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"x": 390,
"y": 640,
"wires": [
[
"f9ef1873.a934d8"
]
]
},
{
"id": "f2903da.de4484",
"type": "link in",
"z": "998f3d00.013738",
"name": "Batt Alarm",
"links": [
"a404769b.a1c1e"
],
"x": 655,
"y": 700,
"wires": [
[
"a36d9476.1c27b8"
]
]
},
{
"id": "40b60915.6cf19",
"type": "function",
"z": "998f3d00.013738",
"name": "reset",
"func": "msg.reset = true;\nreturn msg;",
"outputs": 1,
"noerr": 0,
"x": 1050,
"y": 640,
"wires": [
[
"f9ef1873.a934d8"
]
]
},
{
"id": "f9ef1873.a934d8",
"type": "trigger",
"z": "998f3d00.013738",
"op1": "Meldung",
"op2": "0",
"op1type": "str",
"op2type": "str",
"duration": "-3",
"extend": false,
"units": "min",
"reset": "",
"bytopic": "all",
"name": "Alarm",
"x": 590,
"y": 580,
"wires": [
[
"4ab9d7d7.3b1c4"
]
]
},
{
"id": "a36d9476.1c27b8",
"type": "ui_audio",
"z": "998f3d00.013738",
"name": "Alarm",
"group": "d05bc92c.1c937",
"voice": "en-US",
"always": false,
"x": 830,
"y": 700,
"wires": []
},
{
"id": "d05bc92c.1c937",
"type": "ui_group",
"z": "",
"name": "Clock in Toolbar",
"tab": "1c488775.b324b1",
"order": 7,
"disp": false,
"width": "6",
"collapse": false
},
{
"id": "1c488775.b324b1",
"type": "ui_tab",
"z": "",
"name": "Weather",
"icon": "dashboard",
"order": 2,
"disabled": false,
"hidden": false
}
]