[
  {
    "id": "a1b2c3d4e5f6g7h8",
    "type": "tab",
    "label": "Alexa Agent Webhook",
    "disabled": false,
    "info": "Minimaler Webhook-Flow für den lokalen Alexa-Agenten"
  },
  {
    "id": "http-in-alexa-device-1",
    "type": "http in",
    "z": "a1b2c3d4e5f6g7h8",
    "name": "Alexa Device 1 Webhook",
    "url": "/alexa/device/1",
    "method": "post",
    "upload": false,
    "swaggerDoc": "",
    "x": 180,
    "y": 120,
    "wires": [["fn-alexa-device-1"]]
  },
  {
    "id": "fn-alexa-device-1",
    "type": "function",
    "z": "a1b2c3d4e5f6g7h8",
    "name": "Dispatch Device 1",
    "func": "const operation = msg.payload.operation;\nconst payload = msg.payload.payload || {};\n\nif (operation === 'turnOff') {\n    // Hier echte lokale Logik einbauen, z. B. Homematic / CCU / weiteres Node-RED-Mapping\n    msg.payload = {\n        success: true,\n        result: { executed: true, operation, target: 'device-1' },\n        state: { power: false }\n    };\n    return msg;\n}\n\nif (operation === 'turnOn') {\n    msg.payload = {\n        success: true,\n        result: { executed: true, operation, target: 'device-1' },\n        state: { power: true }\n    };\n    return msg;\n}\n\nmsg.payload = {\n    success: false,\n    result: {},\n    state: {},\n    error: `Unsupported operation: ${operation}`\n};\nreturn msg;",
    "outputs": 1,
    "timeout": "",
    "noerr": 0,
    "initialize": "",
    "finalize": "",
    "libs": [],
    "x": 430,
    "y": 120,
    "wires": [["http-response-alexa-device-1", "debug-alexa-device-1"]]
  },
  {
    "id": "http-response-alexa-device-1",
    "type": "http response",
    "z": "a1b2c3d4e5f6g7h8",
    "name": "HTTP Response",
    "statusCode": "200",
    "headers": {},
    "x": 700,
    "y": 100,
    "wires": []
  },
  {
    "id": "debug-alexa-device-1",
    "type": "debug",
    "z": "a1b2c3d4e5f6g7h8",
    "name": "Alexa Device Debug",
    "active": true,
    "tosidebar": true,
    "console": false,
    "tostatus": false,
    "complete": "payload",
    "targetType": "msg",
    "x": 700,
    "y": 140,
    "wires": []
  }
]
