This object is in archive! 

Asynchronous writing of meter values

David Pritchard shared this question 5 years ago
Need Answer

When you write a value to a meter, why doesn't the rule wait until the value is stored?


If you do this:


Store value 0 in meter attribute xyz.

If (abc)
      Store value 1 in meter attribute xyz

The result will often be that the meter attribute always reads 0, even though the condition "abc" was met. There's a delay (somewhat less than a second, but I imagine it depends how "busy" the box is) in writing the value, but rules don't pause their execution. So you have to insert waits into the rule, which can really start to add up if you write a lot of values.


Isn't this a bug?

Replies (4)

photo
1

Have you tried: "refresh all" before reading?

photo
1

I'll try it. Thanks!

photo
1

Sadly, it doesn't work.


I tried the following rule:


Set meter value to 0
Refresh all
if (1=1)
     Set meter value to 600
     Refresh all
if (1=1) 
     Set meter value to (current value) + 1
     Refresh all

Running it several times, the results vary: 1, 2, 3, 601, 602...


Now I'm going to affirm it: this is a bug.

photo
1

Putting a wait of as little as 0.01 seconds between writes is enough to get 601 in the test rule, consistently. But in real-world conditions that doesn't always seem to be enough. It depends how busy the box is.

Leave a Comment
 
Attach a file