Change trigger delay value with numeric dashboard input

I want do increase or decrease the trigger delay of the trigger node with a numeric dashbord node.
Tried it, but found no solution :frowning:

Well you get a number from the dashboard input and you can define the delay duration by passing msg.delay (in milliseconds).
So on the face of it you only need a change node to move msg.payload to msg.delay and pass it to the trigger.

What have you tried? A screen capture would be helpful, or export the flow and share it here.

Thank you for your reply. I am new here an I am a beginner in Node Red :see_no_evil:

grafik

That is what I tried. It works, but I can't edit the dely with the node "Messintervall".

[
    {
        "id": "a9047d12fa234120",
        "type": "inject",
        "z": "473c8fa3989deff6",
        "name": "set \"on\" at start",
        "props": [
            {
                "p": "payload"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": true,
        "onceDelay": "5",
        "topic": "",
        "payload": "start",
        "payloadType": "str",
        "x": 140,
        "y": 240,
        "wires": [
            [
                "0769e7dc9c67f5d5"
            ]
        ]
    },
    {
        "id": "4b077208ef2e8847",
        "type": "http request",
        "z": "473c8fa3989deff6",
        "name": "",
        "method": "GET",
        "ret": "bin",
        "paytoqs": "body",
        "url": "http://192.168.178.70/api/livedata/status",
        "tls": "",
        "persist": false,
        "proxy": "",
        "insecureHTTPParser": false,
        "authType": "",
        "senderr": false,
        "headers": [
            {
                "keyType": "other",
                "keyValue": "",
                "valueType": "other",
                "valueValue": ""
            },
            {
                "keyType": "other",
                "keyValue": "",
                "valueType": "other",
                "valueValue": ""
            }
        ],
        "x": 490,
        "y": 340,
        "wires": [
            [
                "8827c9c4fa19d2ef"
            ]
        ]
    },
    {
        "id": "5c8d33c1298ecf74",
        "type": "ui_numeric",
        "z": "473c8fa3989deff6",
        "name": "",
        "label": "Messintervall",
        "tooltip": "",
        "group": "b0bb6380880c3925",
        "order": 2,
        "width": 0,
        "height": 0,
        "wrap": false,
        "passthru": true,
        "topic": "payload",
        "topicType": "msg",
        "format": "{{value|number:0}}",
        "min": 0,
        "max": "60000",
        "step": "1000",
        "x": 110,
        "y": 580,
        "wires": [
            [
                "4a316524e4a56171"
            ]
        ]
    },
    {
        "id": "12367ecbefd0b914",
        "type": "inject",
        "z": "473c8fa3989deff6",
        "name": "",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "start",
        "payloadType": "str",
        "x": 90,
        "y": 460,
        "wires": [
            [
                "dc4a337fe49c0b50"
            ]
        ]
    },
    {
        "id": "9946fadd95472053",
        "type": "inject",
        "z": "473c8fa3989deff6",
        "name": "",
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "stop",
        "payloadType": "str",
        "x": 90,
        "y": 510,
        "wires": [
            [
                "dc4a337fe49c0b50"
            ]
        ]
    },
    {
        "id": "dc4a337fe49c0b50",
        "type": "trigger",
        "z": "473c8fa3989deff6",
        "name": "",
        "op1": "1",
        "op2": "",
        "op1type": "str",
        "op2type": "nul",
        "duration": "-30",
        "extend": false,
        "overrideDelay": true,
        "units": "s",
        "reset": "stop",
        "bytopic": "all",
        "topic": "payload",
        "outputs": 1,
        "x": 330,
        "y": 460,
        "wires": [
            [
                "4b077208ef2e8847"
            ]
        ]
    },
    {
        "id": "0769e7dc9c67f5d5",
        "type": "ui_switch",
        "z": "473c8fa3989deff6",
        "name": "PV Messung on/off",
        "label": "<font size=4>Messung on/off",
        "tooltip": "",
        "group": "3a4b73319cf121be",
        "order": 1,
        "width": "6",
        "height": "1",
        "passthru": true,
        "decouple": "false",
        "topic": "payload",
        "topicType": "msg",
        "style": "",
        "onvalue": "start",
        "onvalueType": "str",
        "onicon": "",
        "oncolor": "",
        "offvalue": "stop",
        "offvalueType": "str",
        "officon": "",
        "offcolor": "",
        "animate": false,
        "x": 150,
        "y": 360,
        "wires": [
            [
                "dc4a337fe49c0b50"
            ]
        ]
    },
    {
        "id": "4a316524e4a56171",
        "type": "change",
        "z": "473c8fa3989deff6",
        "name": "",
        "rules": [
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "delay",
                "tot": "flow"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 290,
        "y": 580,
        "wires": [
            [
                "dc4a337fe49c0b50"
            ]
        ]
    },
    {
        "id": "b0bb6380880c3925",
        "type": "ui_group",
        "name": "Dahboard",
        "tab": "fbfd90158448f12f",
        "order": 1,
        "disp": true,
        "width": "6",
        "collapse": false
    },
    {
        "id": "3a4b73319cf121be",
        "type": "ui_group",
        "name": "PV Gesamt",
        "tab": "b1421016ef9b0241",
        "order": 1,
        "disp": true,
        "width": 6,
        "collapse": false
    },
    {
        "id": "fbfd90158448f12f",
        "type": "ui_tab",
        "name": "Einstellungen",
        "icon": "dashboard",
        "order": 3,
        "disabled": false,
        "hidden": false
    },
    {
        "id": "b1421016ef9b0241",
        "type": "ui_tab",
        "name": "PV Dashboard",
        "icon": "dashboard",
        "order": 1,
        "disabled": false,
        "hidden": false
    }
]

Try this simple flow.
See that setting the value of trigger delay is separated from actually using the trigger.

[{"id":"3ae6dc04b0424b83","type":"trigger","z":"09deee63c1b960f7","name":"","op1":"START","op2":"STOP","op1type":"str","op2type":"str","duration":"1000","extend":false,"overrideDelay":true,"units":"ms","reset":"","bytopic":"all","topic":"topic","outputs":1,"x":680,"y":1500,"wires":[["de7e01c12f7864f0"]]},{"id":"2c29924e99e0baf8","type":"ui_button","z":"09deee63c1b960f7","name":"","group":"08ac9b242ae51e8c","order":12,"width":0,"height":0,"passthru":false,"label":"trigger","tooltip":"","color":"","bgcolor":"","className":"","icon":"","payload":"","payloadType":"str","topic":"topic","topicType":"msg","x":130,"y":1520,"wires":[["f2e2fc4ed2a5a217"]]},{"id":"76aae935b0a42e7d","type":"change","z":"09deee63c1b960f7","name":"set delay","rules":[{"t":"set","p":"delay","pt":"msg","to":"triggerDelay","tot":"flow"}],"action":"","property":"","from":"","to":"","reg":false,"x":480,"y":1500,"wires":[["3ae6dc04b0424b83"]]},{"id":"0f824e4ad74d7d0c","type":"ui_numeric","z":"09deee63c1b960f7","name":"","label":"trigger delay","tooltip":"","group":"08ac9b242ae51e8c","order":13,"width":0,"height":0,"wrap":false,"passthru":true,"topic":"topic","topicType":"msg","format":"{{value}}","min":"1000","max":"10000","step":"100","className":"","x":150,"y":1440,"wires":[["2c7206f9e8c87107"]]},{"id":"2c7206f9e8c87107","type":"change","z":"09deee63c1b960f7","name":"store trgger delay","rules":[{"t":"set","p":"triggerDelay","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":510,"y":1440,"wires":[[]]},{"id":"f2e2fc4ed2a5a217","type":"switch","z":"09deee63c1b960f7","name":"check if delay exists","property":"triggerDelay","propertyType":"flow","rules":[{"t":"nnull"},{"t":"else"}],"checkall":"true","repair":false,"outputs":2,"x":300,"y":1520,"wires":[["76aae935b0a42e7d"],["a7bc6f99a2cd7870"]]},{"id":"de7e01c12f7864f0","type":"ui_text","z":"09deee63c1b960f7","group":"08ac9b242ae51e8c","order":14,"width":0,"height":0,"name":"","label":"Triger output","format":"{{msg.payload}}","layout":"row-spread","className":"","x":870,"y":1540,"wires":[]},{"id":"a7bc6f99a2cd7870","type":"change","z":"09deee63c1b960f7","name":"error message","rules":[{"t":"set","p":"payload","pt":"msg","to":"<font color=\"red\">set trigger delay first</font>","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":500,"y":1540,"wires":[["de7e01c12f7864f0"]]},{"id":"08ac9b242ae51e8c","type":"ui_group","name":"Default","tab":"2acb95821445c8af","order":1,"disp":true,"width":"6","collapse":false,"className":""},{"id":"2acb95821445c8af","type":"ui_tab","name":"Home","icon":"dashboard","disabled":false,"hidden":false}]

I think your change mode is wrong.

The dashboard sets msg.payload, you need to move that into msg.delay to pass to the trigger node.
Untitled 2

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.