So könnte eine Passwort Abfrage aussehen, ist mal der erste Entwurf.
der Text im Eingabefeld setzt sich nach 30 sec zurück.
Passwort ist zur Zeit “passwort”
[
{
"id": "04303146ce579e49",
"type": "tab",
"label": "Passwort Abfrage",
"disabled": false,
"info": "",
"env": []
},
{
"id": "fbb1ec5e780c95fa",
"type": "function",
"z": "04303146ce579e49",
"name": "Passwort",
"func": "let passwort = msg.payload\nif (passwort=== \"passwort\"){ //hier das passwort in das richtige ändern\n msg.payload=true;\n flow.set(\"Passwort\",true);\n}\nelse {\n msg.payload = false;\n flow.set(\"Passwort\",false);\n}\nreturn msg;",
"outputs": 1,
"timeout": 0,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 440,
"y": 200,
"wires": [
[
"7912b5233197a378"
]
]
},
{
"id": "cc18547467bfaf2e",
"type": "delay",
"z": "04303146ce579e49",
"name": "",
"pauseType": "delay",
"timeout": "30",
"timeoutUnits": "seconds",
"rate": "1",
"nbRateUnits": "1",
"rateUnits": "second",
"randomFirst": "1",
"randomLast": "5",
"randomUnits": "seconds",
"drop": false,
"allowrate": false,
"outputs": 1,
"x": 310,
"y": 260,
"wires": [
[
"286ab7104881ad48"
]
]
},
{
"id": "45869b629804fc6c",
"type": "ui_text_input",
"z": "04303146ce579e49",
"name": "Passwort",
"label": "Passwort",
"tooltip": "",
"group": "f85e4bf163091de9",
"order": 1,
"width": 0,
"height": 0,
"passthru": true,
"mode": "text",
"delay": 300,
"topic": "topic",
"sendOnBlur": true,
"className": "",
"topicType": "msg",
"x": 220,
"y": 200,
"wires": [
[
"cc18547467bfaf2e",
"fbb1ec5e780c95fa"
]
]
},
{
"id": "286ab7104881ad48",
"type": "function",
"z": "04303146ce579e49",
"name": "Reset",
"func": " msg.payload=\"\";\n \n\nreturn msg;",
"outputs": 1,
"timeout": 0,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 470,
"y": 260,
"wires": [
[
"45869b629804fc6c",
"e7012032763875b8"
]
]
},
{
"id": "0f45d4ee6b7f3070",
"type": "ui_button",
"z": "04303146ce579e49",
"name": "Alarm Aus",
"group": "f85e4bf163091de9",
"order": 1,
"width": 0,
"height": 0,
"passthru": false,
"label": "Alarm Aus",
"tooltip": "",
"color": "",
"bgcolor": "",
"className": "",
"icon": "",
"payload": "true",
"payloadType": "bool",
"topic": "topic",
"topicType": "msg",
"x": 230,
"y": 140,
"wires": [
[
"e7012032763875b8"
]
]
},
{
"id": "e7012032763875b8",
"type": "function",
"z": "04303146ce579e49",
"name": "Alarm Aus",
"func": "let passwort = flow.get(\"Passwort\")\nlet check = msg.payload\nif(check==true && passwort==true){\n msg.payload=true;\n}\nelse\nmsg.payload=false;\nreturn msg;",
"outputs": 1,
"timeout": 0,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 410,
"y": 140,
"wires": [
[
"5682a3aced8a2cfb",
"9ec89130ab151808"
]
]
},
{
"id": "f52e43decacc2b1d",
"type": "debug",
"z": "04303146ce579e49",
"name": "debug 59",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": true,
"complete": "true",
"targetType": "full",
"statusVal": "payload",
"statusType": "auto",
"x": 880,
"y": 120,
"wires": []
},
{
"id": "7912b5233197a378",
"type": "debug",
"z": "04303146ce579e49",
"name": "debug 60",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": true,
"complete": "true",
"targetType": "full",
"statusVal": "payload",
"statusType": "auto",
"x": 680,
"y": 200,
"wires": []
},
{
"id": "76f79f175b349486",
"type": "comment",
"z": "04303146ce579e49",
"name": "hier Passwort ändern",
"info": "",
"x": 480,
"y": 180,
"wires": []
},
{
"id": "9a4abb93544274c5",
"type": "comment",
"z": "04303146ce579e49",
"name": "true = deaktiviert",
"info": "",
"x": 880,
"y": 80,
"wires": []
},
{
"id": "5682a3aced8a2cfb",
"type": "switch",
"z": "04303146ce579e49",
"name": "",
"property": "payload",
"propertyType": "msg",
"rules": [
{
"t": "true"
},
{
"t": "false"
}
],
"checkall": "true",
"repair": false,
"outputs": 2,
"x": 610,
"y": 140,
"wires": [
[
"f52e43decacc2b1d"
],
[
"6bfcb9c60b213a2f"
]
]
},
{
"id": "6bfcb9c60b213a2f",
"type": "debug",
"z": "04303146ce579e49",
"name": "debug 61",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": true,
"complete": "true",
"targetType": "full",
"statusVal": "payload",
"statusType": "auto",
"x": 880,
"y": 180,
"wires": []
},
{
"id": "9ec89130ab151808",
"type": "debug",
"z": "04303146ce579e49",
"name": "debug 62",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": true,
"complete": "true",
"targetType": "full",
"statusVal": "payload",
"statusType": "auto",
"x": 620,
"y": 80,
"wires": []
},
{
"id": "f85e4bf163091de9",
"type": "ui_group",
"name": "Passwort Abfrage",
"tab": "384bfa97aff8324a",
"order": 1,
"disp": true,
"width": 6,
"collapse": false,
"className": ""
},
{
"id": "384bfa97aff8324a",
"type": "ui_tab",
"name": "Passwort userflow",
"icon": "dashboard",
"order": 4,
"disabled": false,
"hidden": false
}
]
Edit
Wenn du in der Texteingabe den Modus auf Passwort einstellst, bekommst du nur Punkte angezeigt. Und wenn du die delayzeit in der Texteingabe auf 0 stellst, musst du mit Enter bestätigen.
So könntest du auch ohne den oberen Bereich mit dem Button den Befehl auslösen.
Dann nimm doch soetwas, da hast du ne Versorgungsspannung von 12v