[
  {
    "id": "911a644b6b6251b8",
    "type": "group",
    "style": {
      "stroke": "#999999",
      "stroke-opacity": "1",
      "fill": "none",
      "fill-opacity": "1",
      "label": true,
      "label-position": "nw",
      "color": "#a4a4a4"
    },
    "nodes": [
      "c7d914f160780f43",
      "c8e0e8776f801080",
      "72e78014ed2b1194",
      "fafd134baf155dcb",
      "84ebef85c87909b6",
      "08517c28215eb14c",
      "5d8f0759da249852",
      "cac20d39b7bcdcfb",
      "b88bd5076b3d2d21",
      "ee8b83110c4f2afa",
      "62fdc3a19bb812eb",
      "a1a28d3705a9d396"
    ],
    "x": 1454,
    "y": 4119,
    "w": 892,
    "h": 322
  },
  {
    "id": "c7d914f160780f43",
    "type": "inject",
    "g": "911a644b6b6251b8",
    "name": "Turn ON",
    "props": [
      {
        "p": "payload"
      }
    ],
    "repeat": "",
    "crontab": "",
    "once": false,
    "onceDelay": "0",
    "topic": "",
    "payload": "true",
    "payloadType": "bool",
    "x": 1560,
    "y": 4220,
    "wires": [
      [
        "ee8b83110c4f2afa"
      ]
    ]
  },
  {
    "id": "c8e0e8776f801080",
    "type": "inject",
    "g": "911a644b6b6251b8",
    "name": "Turn OFF",
    "props": [
      {
        "p": "payload"
      }
    ],
    "repeat": "",
    "crontab": "",
    "once": false,
    "onceDelay": "0",
    "topic": "",
    "payload": "false",
    "payloadType": "bool",
    "x": 1560,
    "y": 4260,
    "wires": [
      [
        "ee8b83110c4f2afa"
      ]
    ]
  },
  {
    "id": "72e78014ed2b1194",
    "type": "debug",
    "g": "911a644b6b6251b8",
    "name": "2 · Feedback",
    "active": true,
    "tosidebar": true,
    "console": false,
    "tostatus": false,
    "complete": "payload",
    "targetType": "msg",
    "statusVal": "",
    "statusType": "auto",
    "x": 2190,
    "y": 4260,
    "wires": []
  },
  {
    "id": "fafd134baf155dcb",
    "type": "debug",
    "g": "911a644b6b6251b8",
    "name": "1 · Switch On/OFF",
    "active": true,
    "tosidebar": true,
    "console": false,
    "tostatus": false,
    "complete": "payload",
    "targetType": "msg",
    "statusVal": "",
    "statusType": "auto",
    "x": 2210,
    "y": 4220,
    "wires": []
  },
  {
    "id": "84ebef85c87909b6",
    "type": "function",
    "g": "911a644b6b6251b8",
    "name": "Smart Toggle",
    "func": "// Toggle logic using context to remember state\nlet currentState = context.get('switchState') || false;\nlet newState = !currentState;\n\n// Save the new state\ncontext.set('switchState', newState);\n\n// Create message with communication object\nmsg.inputTarget = \"Switch On/OFF\";\nmsg.payload = newState;\n\nnode.status({\n    fill: newState ? \"green\" : \"red\",\n    shape: \"dot\", \n    text: newState ? \"ON\" : \"OFF\"\n});\n\nreturn msg;",
    "outputs": 1,
    "timeout": 0,
    "noerr": 0,
    "initialize": "",
    "finalize": "",
    "libs": [],
    "x": 1770,
    "y": 4400,
    "wires": [
      [
        "cac20d39b7bcdcfb"
      ]
    ]
  },
  {
    "id": "08517c28215eb14c",
    "type": "inject",
    "g": "911a644b6b6251b8",
    "name": "Toggle Switch",
    "props": [],
    "repeat": "",
    "crontab": "",
    "once": false,
    "onceDelay": "0",
    "topic": "",
    "x": 1580,
    "y": 4400,
    "wires": [
      [
        "84ebef85c87909b6"
      ]
    ]
  },
  {
    "id": "5d8f0759da249852",
    "type": "comment",
    "g": "911a644b6b6251b8",
    "name": "Communication Switch",
    "info": "## Switch node\nDevice: double-click the device node and choose the device of your installation, then Deploy.\n\n### Input targets\n- `Switch On/OFF` — command, true / false\n- `Feedback` — status, true / false\n\n### Outputs\n1. Switch On/OFF (command)\n2. Feedback (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": 1630,
    "y": 4160,
    "wires": []
  },
  {
    "id": "cac20d39b7bcdcfb",
    "type": "widget-Switch",
    "g": "911a644b6b6251b8",
    "dropdownRoom": "",
    "dropdownCategory": "",
    "dropdownWidget": "",
    "displayName": "Switch (set device)",
    "x": 1960,
    "y": 4260,
    "wires": [
      [
        "fafd134baf155dcb"
      ],
      [
        "72e78014ed2b1194"
      ]
    ]
  },
  {
    "id": "b88bd5076b3d2d21",
    "type": "hypervisu-input-target",
    "g": "911a644b6b6251b8",
    "selectedWidget": "13",
    "selectedInput": "Feedback",
    "displayName": "Input Target",
    "x": 1740,
    "y": 4320,
    "wires": [
      [
        "cac20d39b7bcdcfb"
      ]
    ]
  },
  {
    "id": "ee8b83110c4f2afa",
    "type": "hypervisu-input-target",
    "g": "911a644b6b6251b8",
    "selectedWidget": "13",
    "selectedInput": "Switch On/OFF",
    "displayName": "Input Target",
    "x": 1740,
    "y": 4220,
    "wires": [
      [
        "cac20d39b7bcdcfb"
      ]
    ]
  },
  {
    "id": "62fdc3a19bb812eb",
    "type": "inject",
    "g": "911a644b6b6251b8",
    "name": "Turn ON",
    "props": [
      {
        "p": "payload"
      }
    ],
    "repeat": "",
    "crontab": "",
    "once": false,
    "onceDelay": "0",
    "topic": "",
    "payload": "true",
    "payloadType": "bool",
    "x": 1560,
    "y": 4320,
    "wires": [
      [
        "b88bd5076b3d2d21"
      ]
    ]
  },
  {
    "id": "a1a28d3705a9d396",
    "type": "inject",
    "g": "911a644b6b6251b8",
    "name": "Turn OFF",
    "props": [
      {
        "p": "payload"
      }
    ],
    "repeat": "",
    "crontab": "",
    "once": false,
    "onceDelay": "0",
    "topic": "",
    "payload": "false",
    "payloadType": "bool",
    "x": 1560,
    "y": 4360,
    "wires": [
      [
        "b88bd5076b3d2d21"
      ]
    ]
  }
]