Manually trigger event script on tag

I currently have an event script built on a tag that publishes MQTT data on change. Works great, not an issue with the script. What I am running into is tags that do not change frequently. I really need for the tags to publish at least once a day for downstream reporting whether it changes or not. Is it possible to fire it manually from another source such as another tag or gateway script? Any other way to accomplish something like this?

Put the script into a function in the Project Library. Use the tag change script you are running to fire the script from the Project Library and use a Gateway Events Scheduled script to trigger it daily

4 Likes

I am working on this solution. Any idea what the syntax is for referencing the script via the tag on change event? It is running on the same gateway. It runs fine in the script console, but not on the tag.


1 Like

Tip: post code rather than pictures of code so that we don't have to type it all out to try it or modify it in our answers. Post a screengrab as well if context is important. See Wiki - how to post code on this forum.

You should be careful with this. You are making a network call from a tag's valueChange event. Events that take more than single digit milliseconds to execute can lead to gateway tag subsystem lockup.

Thanks.

I originally was just calling from a valueChange script directly, but was barely publishing due to this being on a UDT with several simultaneous publishes. Due to a bug in the MQTT Engine module I am having to get creative as a work around for now. This is not really my ideal way either, just trying to find some alternative ways to capture the same thing with potential better performance.