Posts: 230
Threads: 47
Joined: Nov 2015
Reputation:
2
12.11.2024, 09:38
(This post was last modified: 12.11.2024, 10:14 by FatMax.)
I have a script where I'm monitoring consumption, but can get no finer numbers than 1, 2, 3 and 4 for my measurements. When consumption is same or above 2 I set an object to true, and when it is below the object goes to false.
However, this is causing some issues as the consumption temporarily drops below 2 for a few milliseconds, causing my object to drop to false.
Does anyone have a best practice or hysteresis-type solution to this kind of problem?
Posts: 4961
Threads: 28
Joined: Aug 2017
Reputation:
228
If it is event script then just add small delay to it and set Execution Mode: First instance only
------------------------------
Ctrl+F5
Posts: 230
Threads: 47
Joined: Nov 2015
Reputation:
2
But I want the object to go to false if it goes below 2 and stays there. Wouldn't your suggestion prevent that?
Posts: 4961
Threads: 28
Joined: Aug 2017
Reputation:
228
it will change only after the delay but if new telegram arrives in the meantime then the current script will be cancelled and new with new value will run.
------------------------------
Ctrl+F5
Posts: 1794
Threads: 6
Joined: Jul 2015
Reputation:
120
Shouldn’t it be “last instance” then?
Posts: 4961
Threads: 28
Joined: Aug 2017
Reputation:
228
True
------------------------------
Ctrl+F5