Viewstat Module Queue
TurnipTruck
Posts: 1,485
Greetings,
The Viewstat module seems to have no built in queue for sequential SEND_COMMANDS. Sending commands right after one and other results is only the first command of the bunch being accepted.
The documentation with the module makes no reference to a recommended queueing time.
Anyone have some direct experiences?
Thank you.
The Viewstat module seems to have no built in queue for sequential SEND_COMMANDS. Sending commands right after one and other results is only the first command of the bunch being accepted.
The documentation with the module makes no reference to a recommended queueing time.
Anyone have some direct experiences?
Thank you.
0
Comments
Evalutation should always take place before implimenting a waste of resources like a WAIT
In regard to above: why cancel on NULL and look for CRLF? If CRLF exists then NULL with never be true. The find_string is sufficient.
And this example doesn't account for situations like this:
In the above, concatenated strings could excede the max value for the type and be dropped. Proper queueing would allow multiple messages without overflowing the datatype. (Within reasonable limits of the architecture).
For a real example of queueing check out:
http://tinyurl.com/zm22q <- Links to sourceforge.net
The syslog module in the same repository has some well implimented queueing as well.
This is working code.
Thanks Dave Hawthorne for the formatting help!
Enclose your code snippet in {code} ... example here ... {/code}, replacing the curly brackets with square ones.
The mistake I do see here is not naming the wait.
Whatever - the guy asked for an example and this was the first one I found. You are wrong on one account though. The queue is defined with more than enough elements (2000) to handle "simultaneous" commands to 12 thermostats in this particular project without overflowing the datatype.
The main purpose of the queue that I created was to allow commands that arrive immediately after each other from a loop of SEND_COMMANDS to have some time between them as they are sent to the device. There is a WAIT 1 that allows commands longer than .1 seconds apart to not fall into the queue. The Viewstat module does not seem to be bothered by a command such as a setpoint up being sent in quick succession from a user at an interface making a change at a human finger speed. I made the queue empty at two second intervals because several commands to the Viewstat module, including the text messaging function seem to need somewhere slightly over one second to complete.
Thank you for the examples by the previous posters. I used a bit of your ideas to write my code. That's what message boards are all about.