Delay time node red

Yes. I wil contact to you later.
Thank you sir.

With pleasure,

Here is the link to my palette:

1 Like

Oh my gosh, I have a problem.
Now, I have 2 mode AUTO and MANUAL.
Auto : when push "0" will delay 10s , "1" not delay
Manual : push "0" or "1" will not delay.
How to make the relay run in 1 of 2 modes?

Add a switch node before the trigger/delay
Add 2 tests:

  1. If mode == AUTO --> go through delay
  2. If mode == MANUAL --> bypass the delay

Give it a go, see if you can solve it yourself (its the best way to learn)


I recommend watching this playlist: Node-RED Essentials. The videos are done by the developers of node-red. They're nice & short and to the point. You will understand a whole lot more in about 1 hour. A small investment for a lot of gain.

image
Can you make a node red for this solution?

Sorry, but why have you screenshot what i wrote?

I only wrote that 6 mins ago so it is doubtful you have tried for yourself.

Please give it a go. It is a quite basic Node-RED thing that users should get to grips with.

If you are struggling, watch the videos i linked to.

If you are still struggling, come back and ask again and tell us what you tried and where you got stuck.

Good luck.

flows (2).json (5.4 KB)
image
After testing the auto or manual mode, the 0 or 1 reading of each mode is faulty
Can you help me fix it?

Please post small flows ↑ as a code block as explained before ↓


As for the flows, I cannot help you - here is why:

When preparing a flow for someone to help you, you should include dummy data instead of DB nodes.

[
    {
        "id": "fae193cd0dc8e980",
        "type": "tab",
        "label": "Flow 2",
        "disabled": false,
        "info": "",
        "env": []
    },
    {
        "id": "78b159310530c451",
        "type": "debug",
        "z": "fae193cd0dc8e980",
        "name": "",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "payload",
        "targetType": "msg",
        "statusVal": "",
        "statusType": "auto",
        "x": 1350,
        "y": 340,
        "wires": []
    },
    {
        "id": "8e9928861d612c8c",
        "type": "switch",
        "z": "fae193cd0dc8e980",
        "name": "",
        "property": "payload",
        "propertyType": "msg",
        "rules": [
            {
                "t": "eq",
                "v": "0",
                "vt": "num"
            },
            {
                "t": "eq",
                "v": "1",
                "vt": "num"
            }
        ],
        "checkall": "true",
        "repair": false,
        "outputs": 2,
        "x": 710,
        "y": 240,
        "wires": [
            [
                "92142dd4cf3952c8"
            ],
            [
                "925b0d49ba99de1c"
            ]
        ]
    },
    {
        "id": "925b0d49ba99de1c",
        "type": "rbe",
        "z": "fae193cd0dc8e980",
        "name": "",
        "func": "rbe",
        "gap": "",
        "start": "",
        "inout": "out",
        "septopics": true,
        "property": "payload",
        "topi": "topic",
        "x": 1130,
        "y": 240,
        "wires": [
            [
                "78b159310530c451"
            ]
        ]
    },
    {
        "id": "92142dd4cf3952c8",
        "type": "trigger",
        "z": "fae193cd0dc8e980",
        "name": "",
        "op1": "",
        "op2": "",
        "op1type": "nul",
        "op2type": "payl",
        "duration": "10",
        "extend": false,
        "overrideDelay": false,
        "units": "s",
        "reset": "",
        "bytopic": "all",
        "topic": "topic",
        "outputs": 1,
        "x": 910,
        "y": 180,
        "wires": [
            [
                "925b0d49ba99de1c"
            ]
        ]
    },
    {
        "id": "ea92a825197434a6",
        "type": "switch",
        "z": "fae193cd0dc8e980",
        "name": "",
        "property": "payload",
        "propertyType": "msg",
        "rules": [
            {
                "t": "eq",
                "v": "auto",
                "vt": "str"
            },
            {
                "t": "eq",
                "v": "manual",
                "vt": "str"
            }
        ],
        "checkall": "true",
        "repair": false,
        "outputs": 2,
        "x": 310,
        "y": 360,
        "wires": [
            [],
            []
        ]
    },
    {
        "id": "f0ebe68bf0cdbc05",
        "type": "debug",
        "z": "fae193cd0dc8e980",
        "name": "debug 1",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "statusVal": "",
        "statusType": "auto",
        "x": 1060,
        "y": 480,
        "wires": []
    },
    {
        "id": "820cbf5efd21e9d1",
        "type": "inject",
        "z": "fae193cd0dc8e980",
        "name": "",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "1",
        "payloadType": "num",
        "x": 530,
        "y": 260,
        "wires": [
            [
                "8e9928861d612c8c"
            ]
        ]
    },
    {
        "id": "96538767676d14f8",
        "type": "inject",
        "z": "fae193cd0dc8e980",
        "name": "",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "0",
        "payloadType": "num",
        "x": 530,
        "y": 200,
        "wires": [
            [
                "8e9928861d612c8c"
            ]
        ]
    },
    {
        "id": "f2dda7f370d27c0c",
        "type": "comment",
        "z": "fae193cd0dc8e980",
        "name": "Simulate Firebase RELAY",
        "info": "",
        "x": 550,
        "y": 300,
        "wires": []
    },
    {
        "id": "67d33e93d2b594b6",
        "type": "inject",
        "z": "fae193cd0dc8e980",
        "name": "",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "1",
        "payloadType": "num",
        "x": 530,
        "y": 520,
        "wires": [
            [
                "f0ebe68bf0cdbc05"
            ]
        ]
    },
    {
        "id": "af4866c8ad435ccd",
        "type": "inject",
        "z": "fae193cd0dc8e980",
        "name": "",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "0",
        "payloadType": "num",
        "x": 530,
        "y": 460,
        "wires": [
            [
                "f0ebe68bf0cdbc05"
            ]
        ]
    },
    {
        "id": "2d424ddbfdc54be1",
        "type": "comment",
        "z": "fae193cd0dc8e980",
        "name": "Simulate Firebase MODE",
        "info": "",
        "x": 130,
        "y": 420,
        "wires": []
    },
    {
        "id": "129b7a849c482a7b",
        "type": "inject",
        "z": "fae193cd0dc8e980",
        "name": "",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "manual",
        "payloadType": "str",
        "x": 130,
        "y": 380,
        "wires": [
            [
                "ea92a825197434a6"
            ]
        ]
    },
    {
        "id": "75abfd18c6320064",
        "type": "inject",
        "z": "fae193cd0dc8e980",
        "name": "",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "auto",
        "payloadType": "str",
        "x": 130,
        "y": 320,
        "wires": [
            [
                "ea92a825197434a6"
            ]
        ]
    },
    {
        "id": "82b75818fecd0530",
        "type": "comment",
        "z": "fae193cd0dc8e980",
        "name": "Simulate Firebase RELAY",
        "info": "",
        "x": 530,
        "y": 580,
        "wires": []
    }
]

unfortunately, that does not help.

please use debug nodes to capture REAL data coming out of the firebase nodes.

There’s a great page in the docs (Working with messages : Node-RED) that will explain how to use the debug panel to find the right path/value for any data item.

Pay particular attention to the part about the buttons that appear under your mouse pointer when you over hover a debug message property in the sidebar.

BX00Cy7yHi

help me fix it.

I am trying, but you are not following instructions. please try again.

I don't have that error.
Are you confused with another article?

What error? I did not mention an error.

I cannot help you if you do not provide REAL sample data that comes out of the firebase nodes.

Add debug node after EVERY firebase node & capture sample data using the Copy Value button.


Nope. I am not. I never said there was an "error", I did not type the word "error" - search the page if you wish.

Yah
Sorry, i get you
I have sent the function node

    {
        "id": "fae193cd0dc8e980",
        "type": "tab",
        "label": "Flow 2",
        "disabled": false,
        "info": "",
        "env": []
    },
    {
        "id": "78b159310530c451",
        "type": "debug",
        "z": "fae193cd0dc8e980",
        "name": "",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "payload",
        "targetType": "msg",
        "statusVal": "",
        "statusType": "auto",
        "x": 1350,
        "y": 340,
        "wires": []
    },
    {
        "id": "8e9928861d612c8c",
        "type": "switch",
        "z": "fae193cd0dc8e980",
        "name": "",
        "property": "payload",
        "propertyType": "msg",
        "rules": [
            {
                "t": "eq",
                "v": "0",
                "vt": "num"
            },
            {
                "t": "eq",
                "v": "1",
                "vt": "num"
            }
        ],
        "checkall": "true",
        "repair": false,
        "outputs": 2,
        "x": 710,
        "y": 240,
        "wires": [
            [
                "92142dd4cf3952c8"
            ],
            [
                "925b0d49ba99de1c"
            ]
        ]
    },
    {
        "id": "925b0d49ba99de1c",
        "type": "rbe",
        "z": "fae193cd0dc8e980",
        "name": "",
        "func": "rbe",
        "gap": "",
        "start": "",
        "inout": "out",
        "septopics": true,
        "property": "payload",
        "topi": "topic",
        "x": 1130,
        "y": 240,
        "wires": [
            [
                "78b159310530c451"
            ]
        ]
    },
    {
        "id": "92142dd4cf3952c8",
        "type": "trigger",
        "z": "fae193cd0dc8e980",
        "name": "",
        "op1": "",
        "op2": "",
        "op1type": "nul",
        "op2type": "payl",
        "duration": "10",
        "extend": false,
        "overrideDelay": false,
        "units": "s",
        "reset": "",
        "bytopic": "all",
        "topic": "topic",
        "outputs": 1,
        "x": 910,
        "y": 180,
        "wires": [
            [
                "925b0d49ba99de1c"
            ]
        ]
    },
    {
        "id": "ea92a825197434a6",
        "type": "switch",
        "z": "fae193cd0dc8e980",
        "name": "",
        "property": "payload",
        "propertyType": "msg",
        "rules": [
            {
                "t": "eq",
                "v": "auto",
                "vt": "str"
            },
            {
                "t": "eq",
                "v": "manual",
                "vt": "str"
            }
        ],
        "checkall": "true",
        "repair": false,
        "outputs": 2,
        "x": 310,
        "y": 360,
        "wires": [
            [],
            []
        ]
    },
    {
        "id": "f0ebe68bf0cdbc05",
        "type": "debug",
        "z": "fae193cd0dc8e980",
        "name": "debug 1",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "statusVal": "",
        "statusType": "auto",
        "x": 1060,
        "y": 480,
        "wires": []
    },
    {
        "id": "820cbf5efd21e9d1",
        "type": "inject",
        "z": "fae193cd0dc8e980",
        "name": "",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "1",
        "payloadType": "num",
        "x": 530,
        "y": 260,
        "wires": [
            [
                "8e9928861d612c8c"
            ]
        ]
    },
    {
        "id": "96538767676d14f8",
        "type": "inject",
        "z": "fae193cd0dc8e980",
        "name": "",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "0",
        "payloadType": "num",
        "x": 530,
        "y": 200,
        "wires": [
            [
                "8e9928861d612c8c"
            ]
        ]
    },
    {
        "id": "f2dda7f370d27c0c",
        "type": "comment",
        "z": "fae193cd0dc8e980",
        "name": "Simulate Firebase RELAY",
        "info": "",
        "x": 550,
        "y": 300,
        "wires": []
    },
    {
        "id": "67d33e93d2b594b6",
        "type": "inject",
        "z": "fae193cd0dc8e980",
        "name": "",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "1",
        "payloadType": "num",
        "x": 530,
        "y": 520,
        "wires": [
            [
                "f0ebe68bf0cdbc05"
            ]
        ]
    },
    {
        "id": "af4866c8ad435ccd",
        "type": "inject",
        "z": "fae193cd0dc8e980",
        "name": "",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "0",
        "payloadType": "num",
        "x": 530,
        "y": 460,
        "wires": [
            [
                "f0ebe68bf0cdbc05"
            ]
        ]
    },
    {
        "id": "2d424ddbfdc54be1",
        "type": "comment",
        "z": "fae193cd0dc8e980",
        "name": "Simulate Firebase MODE",
        "info": "",
        "x": 130,
        "y": 420,
        "wires": []
    },
    {
        "id": "129b7a849c482a7b",
        "type": "inject",
        "z": "fae193cd0dc8e980",
        "name": "",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "manual",
        "payloadType": "str",
        "x": 130,
        "y": 380,
        "wires": [
            [
                "ea92a825197434a6"
            ]
        ]
    },
    {
        "id": "75abfd18c6320064",
        "type": "inject",
        "z": "fae193cd0dc8e980",
        "name": "",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "auto",
        "payloadType": "str",
        "x": 130,
        "y": 320,
        "wires": [
            [
                "ea92a825197434a6"
            ]
        ]
    },
    {
        "id": "82b75818fecd0530",
        "type": "comment",
        "z": "fae193cd0dc8e980",
        "name": "Simulate Firebase RELAY",
        "info": "",
        "x": 530,
        "y": 580,
        "wires": []
    }
]

that is also no good. You did not do what i asked :frowning: I asked

Instead, please add debug nodes and just show me what comes out of those firebase nodes.

1 Like

Omg,sorry for not understanding but now I understand
I will send it to you later


I think before firebase RELAY must have 1 clock pulse for firebase RELAY to push the value down to RELAY

It's not that complicated...

Note: This database has a JSON architecture, use it.
i.e.:

{
  "your-lamp": {
    "value": 0,
    "mode": "auto"
  }
}

Note2: I already said you can replace your recurring reading node with an event.