[
  {
    "id": "503d4505e4a78fbf",
    "type": "group",
    "style": {
      "stroke": "#999999",
      "stroke-opacity": "1",
      "fill": "none",
      "fill-opacity": "1",
      "label": true,
      "label-position": "nw",
      "color": "#a4a4a4"
    },
    "nodes": [
      "charger_demo",
      "inject_start_charging",
      "inject_stop_charging",
      "inject_charging_status",
      "inject_charging_current",
      "inject_connected_status",
      "inject_error_status",
      "inject_actual_power",
      "inject_last_energy",
      "inject_last_duration",
      "debug_start_stop",
      "debug_charging",
      "debug_current",
      "debug_connected",
      "debug_error",
      "debug_power",
      "debug_energy",
      "debug_duration",
      "function_charging_cycle",
      "inject_cycle",
      "comment_charger_logic"
    ],
    "x": 1414,
    "y": 3559,
    "w": 1072,
    "h": 502
  },
  {
    "id": "charger_demo",
    "type": "widget-Charger",
    "g": "503d4505e4a78fbf",
    "dropdownRoom": "",
    "dropdownCategory": "",
    "dropdownWidget": "",
    "displayName": "Charger (set device)",
    "x": 1990,
    "y": 3800,
    "wires": [
      [
        "debug_start_stop"
      ],
      [
        "debug_charging"
      ],
      [
        "debug_current"
      ],
      [
        "debug_connected"
      ],
      [
        "debug_error"
      ],
      [
        "debug_power"
      ],
      [
        "debug_energy"
      ],
      [
        "debug_duration"
      ]
    ]
  },
  {
    "id": "inject_start_charging",
    "type": "inject",
    "g": "503d4505e4a78fbf",
    "name": "Start Charging",
    "props": [
      {
        "p": "inputTarget",
        "v": "Start/Stop",
        "vt": "str"
      },
      {
        "p": "payload",
        "v": "true",
        "vt": "bool"
      }
    ],
    "repeat": "",
    "crontab": "",
    "once": false,
    "onceDelay": "0",
    "topic": "",
    "x": 1530,
    "y": 3660,
    "wires": [
      [
        "charger_demo"
      ]
    ]
  },
  {
    "id": "inject_stop_charging",
    "type": "inject",
    "g": "503d4505e4a78fbf",
    "name": "Stop Charging",
    "props": [
      {
        "p": "inputTarget",
        "v": "Start/Stop",
        "vt": "str"
      },
      {
        "p": "payload",
        "v": "false",
        "vt": "bool"
      }
    ],
    "repeat": "",
    "crontab": "",
    "once": false,
    "onceDelay": "0",
    "topic": "",
    "x": 1530,
    "y": 3700,
    "wires": [
      [
        "charger_demo"
      ]
    ]
  },
  {
    "id": "inject_charging_status",
    "type": "inject",
    "g": "503d4505e4a78fbf",
    "name": "Charging Status (feedback)",
    "props": [
      {
        "p": "inputTarget",
        "v": "Charging",
        "vt": "str"
      },
      {
        "p": "payload",
        "v": "true",
        "vt": "bool"
      }
    ],
    "repeat": "",
    "crontab": "",
    "once": false,
    "onceDelay": "0",
    "topic": "",
    "x": 1570,
    "y": 3740,
    "wires": [
      [
        "charger_demo"
      ]
    ]
  },
  {
    "id": "inject_charging_current",
    "type": "inject",
    "g": "503d4505e4a78fbf",
    "name": "Current 16A (feedback)",
    "props": [
      {
        "p": "inputTarget",
        "v": "Charging Current",
        "vt": "str"
      },
      {
        "p": "payload",
        "v": "16",
        "vt": "num"
      }
    ],
    "repeat": "",
    "crontab": "",
    "once": false,
    "onceDelay": "0",
    "topic": "",
    "x": 1560,
    "y": 3780,
    "wires": [
      [
        "charger_demo"
      ]
    ]
  },
  {
    "id": "inject_connected_status",
    "type": "inject",
    "g": "503d4505e4a78fbf",
    "name": "Connected Status (feedback)",
    "props": [
      {
        "p": "inputTarget",
        "v": "Connected",
        "vt": "str"
      },
      {
        "p": "payload",
        "v": "true",
        "vt": "bool"
      }
    ],
    "repeat": "",
    "crontab": "",
    "once": false,
    "onceDelay": "0",
    "topic": "",
    "x": 1580,
    "y": 3820,
    "wires": [
      [
        "charger_demo"
      ]
    ]
  },
  {
    "id": "inject_error_status",
    "type": "inject",
    "g": "503d4505e4a78fbf",
    "name": "Error Status (feedback)",
    "props": [
      {
        "p": "inputTarget",
        "v": "Error",
        "vt": "str"
      },
      {
        "p": "payload"
      }
    ],
    "repeat": "",
    "crontab": "",
    "once": false,
    "onceDelay": "0",
    "topic": "",
    "payload": "false",
    "payloadType": "bool",
    "x": 1560,
    "y": 3860,
    "wires": [
      [
        "charger_demo"
      ]
    ]
  },
  {
    "id": "inject_actual_power",
    "type": "inject",
    "g": "503d4505e4a78fbf",
    "name": "Power 3200W (feedback)",
    "props": [
      {
        "p": "inputTarget",
        "v": "Actual Power",
        "vt": "str"
      },
      {
        "p": "payload"
      }
    ],
    "repeat": "",
    "crontab": "",
    "once": false,
    "onceDelay": "0",
    "topic": "",
    "payload": "3200",
    "payloadType": "num",
    "x": 1570,
    "y": 3900,
    "wires": [
      [
        "charger_demo"
      ]
    ]
  },
  {
    "id": "inject_last_energy",
    "type": "inject",
    "g": "503d4505e4a78fbf",
    "name": "Energy 45kWh (feedback)",
    "props": [
      {
        "p": "inputTarget",
        "v": "Last Energy",
        "vt": "str"
      },
      {
        "p": "payload"
      }
    ],
    "repeat": "",
    "crontab": "",
    "once": false,
    "onceDelay": "0",
    "topic": "",
    "payload": "45.5",
    "payloadType": "num",
    "x": 1570,
    "y": 3940,
    "wires": [
      [
        "charger_demo"
      ]
    ]
  },
  {
    "id": "inject_last_duration",
    "type": "inject",
    "g": "503d4505e4a78fbf",
    "name": "Duration 4h (feedback)",
    "props": [
      {
        "p": "inputTarget",
        "v": "Last duration",
        "vt": "str"
      },
      {
        "p": "payload"
      }
    ],
    "repeat": "",
    "crontab": "",
    "once": false,
    "onceDelay": "0",
    "topic": "",
    "payload": "14400",
    "payloadType": "num",
    "x": 1560,
    "y": 3980,
    "wires": [
      [
        "charger_demo"
      ]
    ]
  },
  {
    "id": "debug_start_stop",
    "type": "debug",
    "g": "503d4505e4a78fbf",
    "name": "1 · Start/Stop (bool)",
    "active": true,
    "tosidebar": true,
    "console": false,
    "tostatus": false,
    "complete": "payload",
    "targetType": "msg",
    "statusVal": "",
    "statusType": "auto",
    "x": 2270,
    "y": 3680,
    "wires": []
  },
  {
    "id": "debug_charging",
    "type": "debug",
    "g": "503d4505e4a78fbf",
    "name": "2 · Charging State (bool)",
    "active": true,
    "tosidebar": true,
    "console": false,
    "tostatus": false,
    "complete": "payload",
    "targetType": "msg",
    "statusVal": "",
    "statusType": "auto",
    "x": 2290,
    "y": 3720,
    "wires": []
  },
  {
    "id": "debug_current",
    "type": "debug",
    "g": "503d4505e4a78fbf",
    "name": "3 · Charging Current (float)",
    "active": true,
    "tosidebar": true,
    "console": false,
    "tostatus": false,
    "complete": "payload",
    "targetType": "msg",
    "statusVal": "",
    "statusType": "auto",
    "x": 2300,
    "y": 3760,
    "wires": []
  },
  {
    "id": "debug_connected",
    "type": "debug",
    "g": "503d4505e4a78fbf",
    "name": "4 · Connected State (bool)",
    "active": true,
    "tosidebar": true,
    "console": false,
    "tostatus": false,
    "complete": "payload",
    "targetType": "msg",
    "statusVal": "",
    "statusType": "auto",
    "x": 2300,
    "y": 3800,
    "wires": []
  },
  {
    "id": "debug_error",
    "type": "debug",
    "g": "503d4505e4a78fbf",
    "name": "5 · Error State (bool)",
    "active": true,
    "tosidebar": true,
    "console": false,
    "tostatus": false,
    "complete": "payload",
    "targetType": "msg",
    "statusVal": "",
    "statusType": "auto",
    "x": 2280,
    "y": 3840,
    "wires": []
  },
  {
    "id": "debug_power",
    "type": "debug",
    "g": "503d4505e4a78fbf",
    "name": "6 · Actual Power (float)",
    "active": true,
    "tosidebar": true,
    "console": false,
    "tostatus": false,
    "complete": "payload",
    "targetType": "msg",
    "statusVal": "",
    "statusType": "auto",
    "x": 2280,
    "y": 3880,
    "wires": []
  },
  {
    "id": "debug_energy",
    "type": "debug",
    "g": "503d4505e4a78fbf",
    "name": "7 · Last Charge Energy (float)",
    "active": true,
    "tosidebar": true,
    "console": false,
    "tostatus": false,
    "complete": "payload",
    "targetType": "msg",
    "statusVal": "",
    "statusType": "auto",
    "x": 2310,
    "y": 3920,
    "wires": []
  },
  {
    "id": "debug_duration",
    "type": "debug",
    "g": "503d4505e4a78fbf",
    "name": "8 · Last Charge Duration (float)",
    "active": true,
    "tosidebar": true,
    "console": false,
    "tostatus": false,
    "complete": "payload",
    "targetType": "msg",
    "statusVal": "",
    "statusType": "auto",
    "x": 2310,
    "y": 3960,
    "wires": []
  },
  {
    "id": "function_charging_cycle",
    "type": "function",
    "g": "503d4505e4a78fbf",
    "name": "Full Charging Cycle",
    "func": "// Simulate a full charging cycle\nlet cycle = [\n    // Start charging\n    { inputTarget: \"Start/Stop\", payload: true, delay: 0 },\n    \n    // Simulate progressive charging status updates\n    { inputTarget: \"Charging\", payload: true, delay: 1000 },\n    { inputTarget: \"Connected\", payload: true, delay: 1500 },\n    { inputTarget: \"Charging Current\", payload: 8, delay: 2000 },\n    { inputTarget: \"Actual Power\", payload: 5500, delay: 2500 },\n    \n    // Increase power\n    { inputTarget: \"Charging Current\", payload: 16, delay: 4000 },\n    { inputTarget: \"Actual Power\", payload: 11000, delay: 4500 },\n    \n    // Complete charging\n    { inputTarget: \"Start/Stop\", payload: false, delay: 7000 },\n    { inputTarget: \"Charging\", payload: false, delay: 7500 },\n    { inputTarget: \"Last Energy\", payload: 45, delay: 8000 },\n    { inputTarget: \"Last duration\", payload: 240, delay: 8500 }\n];\n\nnode.status({\n    fill: \"blue\",\n    shape: \"dot\", \n    text: \"🔌 Running Charging Cycle\"\n});\n\n// Send each message with delay\ncycle.forEach((msg, index) => {\n    setTimeout(() => {\n        node.send(msg);\n        if (index === cycle.length - 1) {\n            node.status({\n                fill: \"green\",\n                shape: \"dot\", \n                text: \"✅ Cycle Complete\"\n            });\n        }\n    }, msg.delay);\n});\n\nreturn null;",
    "outputs": 1,
    "timeout": 0,
    "noerr": 0,
    "initialize": "",
    "finalize": "",
    "libs": [],
    "x": 1760,
    "y": 4020,
    "wires": [
      [
        "charger_demo"
      ]
    ]
  },
  {
    "id": "inject_cycle",
    "type": "inject",
    "g": "503d4505e4a78fbf",
    "name": "Run Charging Cycle",
    "props": [],
    "repeat": "",
    "crontab": "",
    "once": false,
    "onceDelay": "0",
    "topic": "",
    "x": 1550,
    "y": 4020,
    "wires": [
      [
        "function_charging_cycle"
      ]
    ]
  },
  {
    "id": "comment_charger_logic",
    "type": "comment",
    "g": "503d4505e4a78fbf",
    "name": "Communication EV Charger System",
    "info": "## Charger node\nDevice: double-click the device node and choose the device of your installation, then Deploy.\n\n### Input targets\n- `Start/Stop` — command, true / false\n- `Charging Current` — command, A\n- `Charging`, `Connected`, `Error` — feedback, true / false\n- `Actual Power` (W), `Last Energy` (kWh), `Last duration` — feedback\n\n### Outputs\n1. Start/Stop · 2. Charging · 3. Charging Current · 4. Connected · 5. Error · 6. Actual Power · 7. Last Energy · 8. Last duration\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": 1680,
    "y": 3600,
    "wires": []
  }
]