Gateway Event Scripts - Tag change event don't fire

I try to setup a gateway evnt script on tag change and run a function in my Gateway Scripting Project, but the event is not fired.


image

It’s a simple function that write into a file…

def wLog(msg):
	f = open("C:\\Users\\lucm\\Desktop\\MyLogFile.txt","a")
	from time import strftime
	timestr = strftime("%Y-%m-%d %H:%M:%S")
	m = "[" + timestr + "] " + msg + "\n"
	f.write(m)
	f.close()

I use many script directly into my tags and all fired great, but this time I want to put it into the gateway event and can’t understand why the event is not fired.

Gateway Event Tag Change scripts (and any other event script in this section) belong to a project, so they need to reference a function defined in the project (or a parent’s) script library.

The tag change scripts defined directly on tags are the ones that do not belong to any project and will use the project designated as “Gateway Scripting Project”.

Also, does user lucm exist on the gateway? And would the gateway service have access to that user’s directory? (Generally not.) A proper test would be to write to a folder that is owned by the Ignition service.

You might have entries in your gateway log showing a failure to open the given file.

Anyone else notice the change trigger “value” is unchecked…

2 Likes

The script is in the same project that I set my gateway tag events…
image

I’m in testing mode, the gateway run on my local machine and my wLog function works well in every scope. I use it as console for debugging.

I don’t want to get the value, I just want a quality change event…

I think have different logging methods for testing vs. production is a disaster in the making. Your wLog() function looks pretty fragile to me. Aside from that, you didn’t indicate if there are any messages in your real gateway log. I’ll be out of touch today, but that’s where I would look were I in your shoes.

Look closer at @Kevin.Herron’s comment: Project tag change events have access to the scripts in their inheritence hierarchy, which doesn’t necessarily include the scripts accessible to the Gateway Scripting Project that tag events use.

I don’t want a robust solution, I just use that function as consol to print something to trace my code. When I put it into a tag on quality change event it work fine. My gateway tag change script is in the same project of my _Functions.wLog function and that project is also my Gateway Scripting Project. I think it have no reason to not fired.

That script works wheel

That one not


It’s the same tag…

I have save my project and don’t see my Tag Change into the Status/Systems/Gateway Scripts…

I run on version 8.0.13

I have add Startup, Shutdown, Timer and Message Handler event and only Startup and Shutdown is shown in the Gateway script…

If this is your gateway scripting project, are you sure it is runnable (not inheritable)?

It’s an inheritable project. Why inheritable can have Startup/Shutdown event and not Tag, Timer and message event.

I have many projects that I want to base that project and all needs to have same tags event. I want a simple way to configure and update all projects and using an inheritable project semms to be the bes way to do it.

What’s the best solution for me now?

1 Like

Startup and Shutdown scripts from an inheritable project should not run. If they do, this is most probably a bug.
Are you sure it is not an other, runnable project that is executing those scripts? I am not sure, but i think inherited projects may shutdown and restart when a 'parent' project is changed.

2 Likes

I found why my gateway event tag script in my inheritable project wasn’t publish. The gateway event on my heritate project is overrided. I don’t find on right click a solution to revert it.

If you delete the overridden script it will revert back to the underlying inheritable one.

All seems to be good now…

Thanks

hey brother how did you solve your problem? i have the same issue but im using timer,
it seems the event i generated are not showing in status>gateway scripts

I have builded a side project herited from my script project and I have place my tag event in.

you put the event on the parent project (script project)? because i think thats my problem, i think i need to put the event on my parent project