Page 1 of 1

Python Connections framework : behaviour of delay

Posted: Sunday 30 September 2018 15:19
by pipiche
In the wiki: https://www.domoticz.com/wiki/Developin ... onnections

There is some doc on Delay for the Send function.
Number of seconds to delay message send.
Note that Domoticz will send the message sometime after this period. Other events will be processed in the intervening period so delayed sends will be processed out of order. This feature may be useful during delays when physical devices turn on.

In reality what is the behaviour if I'm using 1 sec delay. Does that mean that I will serialize and get 1s between each send ?

Let imaging I do the following

myConn.Send(Message=myMessage1, Delay=4)
myConn.Send(Message=myMessage2, Delay=4)
myConn.Send(Message=myMessage3, Delay=4)
myConn.Send(Message=myMessage4, Delay=4)

Is Message2 sent 4 seconds after Message1 ? If not, do I have a possibility to have a delay of nSec between each sent ?

Re: Python Connections framework : behaviour of delay

Posted: Sunday 30 September 2018 15:52
by Dnpwwo
@pipiche,

The delay is from when the Send statement is executed. If you want messages sent with 1 second between them use something like:

Code: Select all

myConn.Send(Message=myMessage1, Delay=4)
myConn.Send(Message=myMessage2, Delay=5)
myConn.Send(Message=myMessage3, Delay=6)
myConn.Send(Message=myMessage4, Delay=7)
the first message will be sent after 4 seconds, the next one a second later and so on...

Messages are always executed in the order they are queued except if a delay is used to subvert that behaviour like:

Code: Select all

myConn.Send(Message=SentFourth, Delay=5)
myConn.Send(Message=SentFirst)
myConn.Send(Message=SentThird, Delay=2)
myConn.Send(Message=SentSecond)

Re: Python Connections framework : behaviour of delay

Posted: Sunday 30 September 2018 15:53
by pipiche
Thanks for the confirmation....