[
    {
        "id": "b35a3b0f4c7b0001",
        "type": "tab",
        "label": "Startup Dimmer Reset",
        "disabled": false,
        "info": ""
    },
    {
        "id": "inject_startup_reset",
        "type": "inject",
        "z": "b35a3b0f4c7b0001",
        "name": "Beim Start einmal auslösen",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": true,
        "onceDelay": 2,
        "topic": "",
        "payload": "",
        "payloadType": "str",
        "x": 210,
        "y": 120,
        "wires": [
            [
                "fn_reset_all_dimmers"
            ]
        ]
    },
    {
        "id": "fn_reset_all_dimmers",
        "type": "function",
        "z": "b35a3b0f4c7b0001",
        "name": "Alle Dimmer auf 0 %",
        "func": "// Wird beim Start einmal ausgelöst: alle Dimmer per VanPi-MQTT-API auf 0 setzen\n// Dimmer-Nummern in VanPi (1 = dimmer0, 2 = dimmer1, 3 = dimmer2, ...)\n\nconst dimmers = [1, 2, 3]; // HIER anpassen, falls du mehr/weniger Dimmer hast\n\nnode.warn(\"Startup: setze Dimmer \" + JSON.stringify(dimmers) + \" auf 0%\");\n\n// Für jeden Dimmer eine MQTT-Message schicken\nfor (let i = 0; i < dimmers.length; i++) {\n    const nr = dimmers[i];\n    const msgOut = {\n        topic: \"pkw/cmnd/dimmer/\" + nr + \"/POWER\",\n        payload: 0\n    };\n    node.send(msgOut);\n}\n\n// Wir haben alle Nachrichten mit node.send verschickt\nreturn null;",
        "outputs": 1,
        "timeout": 0,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 470,
        "y": 120,
        "wires": [
            [
                "mqtt_out_dimmer_reset",
                "debug_dimmer_reset"
            ]
        ]
    },
    {
        "id": "mqtt_out_dimmer_reset",
        "type": "mqtt out",
        "z": "b35a3b0f4c7b0001",
        "name": "zu VanPi-Dimmer-API",
        "topic": "",
        "qos": "0",
        "retain": "false",
        "respTopic": "",
        "contentType": "",
        "userProps": "",
        "correl": "",
        "expiry": "",
        "broker": "0ddb07c65cbb68bc",
        "x": 770,
        "y": 100,
        "wires": []
    },
    {
        "id": "debug_dimmer_reset",
        "type": "debug",
        "z": "b35a3b0f4c7b0001",
        "name": "Startup Reset Debug",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": true,
        "complete": "true",
        "targetType": "full",
        "statusVal": "payload",
        "statusType": "auto",
        "x": 800,
        "y": 160,
        "wires": []
    },
    {
        "id": "0ddb07c65cbb68bc",
        "type": "mqtt-broker",
        "name": "",
        "broker": "localhost",
        "port": "1883",
        "clientid": "",
        "autoConnect": true,
        "usetls": false,
        "protocolVersion": "4",
        "keepalive": "60",
        "cleansession": true,
        "autoUnsubscribe": true,
        "birthTopic": "",
        "birthQos": "0",
        "birthPayload": "",
        "birthMsg": {},
        "closeTopic": "",
        "closeQos": "0",
        "closePayload": "",
        "closeMsg": {},
        "willTopic": "",
        "willQos": "0",
        "willPayload": "",
        "willMsg": {},
        "userProps": "",
        "sessionExpiry": ""
    }
]