Question on timer

Hello all.
I'm new to Node Red and I have I question about timers.
I receive several MQTT msg for different motion sensors and these control different lamps which must stay on for different times.
My question:
is the a timer node which can be started several times, always for a diferent time, by the incoming msg an trigger an output when time 1 triggers and again when time 2 triggers and so on.
Or do I need to use several timer nodes?

Hi and welcome to the forum.

Which timer node are you using?

If each lamp stays on for a fixed time (but each one is different) you could use the trigger node.

Just before the trigger node you would place a change node and set msg.delay to the value of milliseconds that lamp needs to be on for.

eg: If for 10 seconds you would set msg.delay to 10000
Then tick the override with msg.delay option.

Then in the trigger node send on then off to turn the lamp on and off.

Or if the On time is always the same for a particular lamp then you can configure the time in the Trigger node for that lamp, rather than in the message.

@ Trying_to_learn and @ Co,lin

Thanks for the reply.

I use the countdown node.
I'll read the description of the trigger and change node and try them out.
I let you know the result.

As far as I understand those nodes this is not and answer on my question.

Let me try to describe my flow.

  1. mqtt msg received from sensor_1 goes
  2. to function node to check for night and if other lamps already on in that room and if Ok send
  3. command lamp_1
  4. the same function node is used for sensor_2, _3, _4 and lamp_2, _3, _4

now the question i have: is it possible with 1 node to start multiple different timers, one for each sensor / lamp combination or do I need a separate timer node for each sensor / lamp combination?

But maybe I misunderstood your answers.

The trigger node can handle each property you wish as separate delays and delay times.

[{"id":"1f2406cc91a112ea","type":"inject","z":"65617ffeb779f51c","name":"","props":[{"p":"payload"},{"p":"delay","v":"3000","vt":"num"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"lamp1","payloadType":"str","x":110,"y":320,"wires":[["8734edfbf6593760"]]},{"id":"8734edfbf6593760","type":"trigger","z":"65617ffeb779f51c","name":"","op1":"on","op2":"off","op1type":"str","op2type":"str","duration":"30","extend":true,"overrideDelay":true,"units":"s","reset":"","bytopic":"topic","topic":"payload","outputs":1,"x":310,"y":380,"wires":[["752f9e00aec8eaa2"]]},{"id":"449afa77421c1947","type":"inject","z":"65617ffeb779f51c","name":"","props":[{"p":"payload"},{"p":"delay","v":"5000","vt":"num"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"lamp2","payloadType":"str","x":90,"y":380,"wires":[["8734edfbf6593760"]]},{"id":"faa494c287263735","type":"inject","z":"65617ffeb779f51c","name":"","props":[{"p":"payload"},{"p":"delay","v":"10000","vt":"num"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"lamp3","payloadType":"str","x":90,"y":440,"wires":[["8734edfbf6593760"]]},{"id":"752f9e00aec8eaa2","type":"debug","z":"65617ffeb779f51c","name":"debug 237","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":510,"y":380,"wires":[]}]

And is it possible to see from which input the off msg is coming.
I mean if the delay of lamp1 expires how can one see it is from lamp1.

I found it: send original msg.

It is working. thanks for the information.

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