Event Handler Setting Meta Point Failing
-
Whoa, that's not good. I have committed a fix and we'll be releasing core 3.4.1 to address this. Thanks for bringing it to our attention.
-
@phildunlap said in Event Handler Setting Meta Point Failing:
Whoa, that's not good. I have committed a fix and we'll be releasing core 3.4.1 to address this. Thanks for bringing it to our attention.
Glad to hear it was discovered early :)
Any workarounds until 3.4.1?
-
We'll be releasing 3.4.1 today.
-
@phildunlap
Thanks!Thanks for the quick fix as well.
-
3.4.1 is released.
-
Thanks @phildunlap
Upgrade went smooth and what we were trying to do kind of worked, but still not working as expected.
I am now able to create an event handler to set a point to a static value if an event is triggered -- and that works just fine. However, the point we are setting almost instantly goes back to 0, despite the event still being active.
Screenshots:
Event Detector:
Proof that the event is still active:
Event Handler:
History of the point we are trying to set, note it goes active, and then 8 seconds later inactive for some reason (even though we never came close to hiting the reset limit of <60)
-
We can see in the annotation that it wasn't the inactive event doing it. So, what could trigger that meta point to recompute itself? Is 0 the value it would get if it executed?
-
@phildunlap said in Event Handler Setting Meta Point Failing:
We can see in the annotation that it wasn't the inactive event doing it. So, what could trigger that meta point to recompute itself? Is 0 the value it would get if it executed?
Hi,
Sorry -- unsure what you mean by if "...it was executed"
Nothing else changes that point except the event handler.
Here's a screeenshot of the metapoint details:
-
While I have contemplated making meta points that don't have execution conditions (would be useful to hit 'refresh point value' on, as that can also trigger the meta script), I haven't yet. So, either your meta point has a point in its context that has 'update context' checked and that triggers the meta points execution, or you have the update event set to something other than context update and it's executing at some specified rate or cron.
-
Ah, screenshots. You probably want to change that script body to
return UNCHANGED;
or use a virtual point instead. Currently I would expect it gets a value of 0 (casting a null return value to a numeric) every time that context point updates. -
Putting
return UNCHANGED
worked!Just a follow up questions so we don't have to bug you as much in the future:
Can you provide us some guidance on where to find documentation on virtual points?
How does a virtual point differ from an meta data point?
Thanks again for all of your hard work in helping us get this working.
-
Certainly! Sorry you were inconvenienced by the queuing issue!
Alas the documentation is scattered around the forum primarily, although the context help (blue ? next to the data source name on the edit page) is useful. Virtual points are perhaps the simplest of points. You can disable polling on the data source, and then they're just points to set values into. The data source can also poll to make the points do simple things like increment, generate random values, alternate, or whatever is sensible to the data type.
Meta points are event-driven timer-driven script bodies that are an iceberg of features with limitless use cases somewhat described here: https://github.com/infiniteautomation/ma-core-public/blob/main/Core/web/WEB-INF/dox/mangoJavaScript.htm
I have posted a great many examples of meta points and scripts around the forum.