Adding a delay to injections

I have a few sensors, I'd like to poll regularly, is there a recommended way to add a delay for that?

[{"id":"f333eff6.397c1","type":"tab","label":"Flow 2","disabled":false,"info":""},{"id":"2c9cd50b.09aca2","type":"inject","z":"f333eff6.397c1","name":"Temp-Sued","props":[{"p":"sensor","v":"tempSued","vt":"str"},{"p":"topic","vt":"str"}],"repeat":"6","crontab":"","once":true,"onceDelay":0.1,"topic":"26.E1CD92010000/temperature","payloadType":"str","x":690,"y":300,"wires":[["8d78bdc3.c230a8"]]},{"id":"8d78bdc3.c230a8","type":"owfs","z":"f333eff6.397c1","name":"1-wire","uncached":false,"mode":"read","host":"","port":4304,"paths":[],"x":930,"y":300,"wires":[[]]}]

So, I'd like to wait like 2secs for that sensor and 5secs for the next?

or other way round: can I read-out all 1-wire sensors ootb?

Sorry, but what you posted doesn't really help.

You also may need to edit that new bit of code so it can be exported.

Sorry, if it was unclear - I guess, you need node-red-contrib-owfs : owfs for importing my flow.

But, apart from that, my question is:

  1. you have different endpoints on the same machine/technology
  2. you want to poll from that endpoints regularly
  3. you want to reduce load from that machine/technology

one solution to 3. was to insert delays to the injections. As it is right now (or as I see it), you can use timestamp with an interval of xx sec/min/..., but you can't use like cron-like syntax, so that I could say:

  • sensor1: every 5min 2secs
  • sensor2: every 5min 5secs
  • sensor3: every 5min 8secs
  • ...

hope, it became more clear now... :wink:

That's what is stumping me.

What do you mean?

Do you mean:

The first pulse happens 2 seconds after start and all others are at 5?

I guess, your answer overlapped my new post. My goal is to avoid reading out in parallel, which - depending on the technology - doesn't work, so I'd like to add tiny intervals in the read-outs, so to avoid parallel polls...

So why not send a signal and put delay nodes to send it to the sensors?

A bit like this:

Values in the delay node is nominal.

1 Like

Thanks - I was blind! :wink:

Don't worry. We all have our bad days.

1 Like

If you use multiple owfs nodes you shouldn't need to delay them, I advise against using the checkbox method in the node., it is safer to explicitly set the topic. Using the checkboxes a problem can arise if you open the node when one of the sensors is not available, it will be removed from the list of sensors to be fetched and will not automatically be re-included when the sensor recovers, unless you open the node again. I do it like this

In addition it is worth looking at aliasing in owserver. It is very easy to do that and then you can use addresses like /bedroom_temp/temperaturerather than 26.E1CD92010000/temperature.

1 Like

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