Python Connections framework : behaviour of delay Topic is solved

Python and python framework

Moderator: leecollings

Post Reply
pipiche
Posts: 2016
Joined: Monday 02 April 2018 20:33
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: France
Contact:

Python Connections framework : behaviour of delay

Post 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 ?
Zigbee for Domoticz plugin / RPI3B+ / Electrolama ZZH-P / 45 devices

If the plugin provides you value, you can support me with a donation Paypal.

Wiki is available here.

Zigbee for Domoticz FAQ
User avatar
Dnpwwo
Posts: 820
Joined: Sunday 23 March 2014 9:00
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Melbourne, Australia
Contact:

Re: Python Connections framework : behaviour of delay

Post 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)
The reasonable man adapts himself to the world; the unreasonable one persists to adapt the world to himself. Therefore all progress depends on the unreasonable man. George Bernard Shaw
pipiche
Posts: 2016
Joined: Monday 02 April 2018 20:33
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: France
Contact:

Re: Python Connections framework : behaviour of delay

Post by pipiche »

Thanks for the confirmation....
Zigbee for Domoticz plugin / RPI3B+ / Electrolama ZZH-P / 45 devices

If the plugin provides you value, you can support me with a donation Paypal.

Wiki is available here.

Zigbee for Domoticz FAQ
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest