[
  {
    "id": "7e7c3cf249ca339d",
    "type": "group",
    "style": {
      "stroke": "#999999",
      "stroke-opacity": "1",
      "fill": "none",
      "fill-opacity": "1",
      "label": true,
      "label-position": "nw",
      "color": "#a4a4a4"
    },
    "nodes": [
      "3b1106d666b0326b",
      "b64994844b46f472",
      "1d92ad9ca972582d",
      "4e88c612803ed072",
      "da99fe5d5596337f",
      "c3cdfdeb91b9de7f",
      "d93cc6638c19374e",
      "ec50d9d3fae0bb80",
      "37086bffe0780184",
      "1452f435c0bb1546",
      "f8467f055baf8f21",
      "1f7e78df1a07a409"
    ],
    "x": 24,
    "y": 5219,
    "w": 1032,
    "h": 302
  },
  {
    "id": "3b1106d666b0326b",
    "type": "widget-DoorLock",
    "g": "7e7c3cf249ca339d",
    "dropdownRoom": "",
    "dropdownCategory": "",
    "dropdownWidget": "",
    "displayName": "Door Lock (set device)",
    "x": 570,
    "y": 5360,
    "wires": [
      [
        "4e88c612803ed072"
      ],
      [
        "da99fe5d5596337f"
      ]
    ]
  },
  {
    "id": "b64994844b46f472",
    "type": "inject",
    "g": "7e7c3cf249ca339d",
    "name": "Lock",
    "props": [
      {
        "p": "payload"
      }
    ],
    "repeat": "",
    "crontab": "",
    "once": false,
    "onceDelay": "0",
    "topic": "",
    "payload": "true",
    "payloadType": "bool",
    "x": 120,
    "y": 5320,
    "wires": [
      [
        "37086bffe0780184"
      ]
    ]
  },
  {
    "id": "1d92ad9ca972582d",
    "type": "inject",
    "g": "7e7c3cf249ca339d",
    "name": "Unlock",
    "props": [
      {
        "p": "payload"
      }
    ],
    "repeat": "",
    "crontab": "",
    "once": false,
    "onceDelay": "0",
    "topic": "",
    "payload": "false",
    "payloadType": "bool",
    "x": 120,
    "y": 5360,
    "wires": [
      [
        "37086bffe0780184"
      ]
    ]
  },
  {
    "id": "4e88c612803ed072",
    "type": "debug",
    "g": "7e7c3cf249ca339d",
    "name": "1 · Lock/Unlock (bool)",
    "active": true,
    "tosidebar": true,
    "console": false,
    "tostatus": false,
    "complete": "payload",
    "targetType": "msg",
    "statusVal": "",
    "statusType": "auto",
    "x": 850,
    "y": 5340,
    "wires": []
  },
  {
    "id": "da99fe5d5596337f",
    "type": "debug",
    "g": "7e7c3cf249ca339d",
    "name": "2 · Lock/Unlock Feedback (bool)",
    "active": true,
    "tosidebar": true,
    "console": false,
    "tostatus": false,
    "complete": "payload",
    "targetType": "msg",
    "statusVal": "",
    "statusType": "auto",
    "x": 880,
    "y": 5380,
    "wires": []
  },
  {
    "id": "c3cdfdeb91b9de7f",
    "type": "function",
    "g": "7e7c3cf249ca339d",
    "name": "Smart Lock Toggle",
    "func": "// Toggle lock logic using context to remember state\nlet currentState = context.get('lockState') || false;\nlet newState = !currentState;\n\n// Save the new state\ncontext.set('lockState', newState);\n\n// Create message with communication object\nmsg.inputTarget = \"Lock/Unlock\";\nmsg.payload = newState;\n\nnode.status({\n    fill: newState ? \"red\" : \"green\",\n    shape: \"dot\", \n    text: newState ? \"🔒 LOCKED\" : \"🔓 UNLOCKED\"\n});\n\nreturn msg;",
    "outputs": 1,
    "timeout": 0,
    "noerr": 0,
    "initialize": "",
    "finalize": "",
    "libs": [],
    "x": 380,
    "y": 5480,
    "wires": [
      [
        "3b1106d666b0326b"
      ]
    ]
  },
  {
    "id": "d93cc6638c19374e",
    "type": "inject",
    "g": "7e7c3cf249ca339d",
    "name": "Toggle Lock",
    "props": [],
    "repeat": "",
    "crontab": "",
    "once": false,
    "onceDelay": "0",
    "topic": "",
    "x": 140,
    "y": 5480,
    "wires": [
      [
        "c3cdfdeb91b9de7f"
      ]
    ]
  },
  {
    "id": "ec50d9d3fae0bb80",
    "type": "comment",
    "g": "7e7c3cf249ca339d",
    "name": "Communication Door Lock",
    "info": "## Door Lock node\nDevice: double-click the device node and choose the device of your installation, then Deploy.\n\n### Input targets\n- `Lock/Unlock` — command: true = lock, false = unlock\n- `Feedback` — feedback, true / false\n\n### Outputs\n1. Lock/Unlock · 2. Feedback\n\n### Rules (node-red-cgen-widget-nodes 1.15)\n- `msg.inputTarget` must match a name above exactly (case-sensitive). Use an **Input Target** node to pick it from a list. A message with a missing or unknown target is ignored.\n- A message from the flow is sent to the server and also leaves on the output of the same name.\n- Outputs also fire when the device changes elsewhere: a **command** output when the app, a scenario, an automation or another flow commands it (only when the value changes), a **feedback** output each time the device reports a value.\n- Writing a feedback / status target updates the value HyperVisu shows; nothing is sent to the device. Use it with VIRTUAL devices.",
    "x": 250,
    "y": 5260,
    "wires": []
  },
  {
    "id": "37086bffe0780184",
    "type": "hypervisu-input-target",
    "g": "7e7c3cf249ca339d",
    "selectedWidget": "20",
    "selectedInput": "Lock/Unlock",
    "displayName": "Input Target",
    "x": 290,
    "y": 5340,
    "wires": [
      [
        "3b1106d666b0326b"
      ]
    ]
  },
  {
    "id": "1452f435c0bb1546",
    "type": "hypervisu-input-target",
    "g": "7e7c3cf249ca339d",
    "selectedWidget": "20",
    "selectedInput": "Feedback",
    "displayName": "Input Target",
    "x": 320,
    "y": 5420,
    "wires": [
      [
        "3b1106d666b0326b"
      ]
    ]
  },
  {
    "id": "f8467f055baf8f21",
    "type": "inject",
    "g": "7e7c3cf249ca339d",
    "name": "Lock",
    "props": [
      {
        "p": "payload"
      }
    ],
    "repeat": "",
    "crontab": "",
    "once": false,
    "onceDelay": "0",
    "topic": "",
    "payload": "true",
    "payloadType": "bool",
    "x": 130,
    "y": 5400,
    "wires": [
      [
        "1452f435c0bb1546"
      ]
    ]
  },
  {
    "id": "1f7e78df1a07a409",
    "type": "inject",
    "g": "7e7c3cf249ca339d",
    "name": "Unlock",
    "props": [
      {
        "p": "payload"
      }
    ],
    "repeat": "",
    "crontab": "",
    "once": false,
    "onceDelay": "0",
    "topic": "",
    "payload": "false",
    "payloadType": "bool",
    "x": 130,
    "y": 5440,
    "wires": [
      [
        "1452f435c0bb1546"
      ]
    ]
  }
]