Scripting in Alarm Notification

Hi all!
I tried to use Script block in Alarm Pipeline with easy scripts like:

def handleAlarm(event): print 10


def handleAlarm(event): system.tag.write("TestTag", 3)

It does not work. No one message in Console and no one errors. And tag still have old value…
When I use Notification block instead Script block I receive a SMS.

Maybe I’m doing something wrong?


A couple thoughts on this.

Maybe using the print Python statement is outputing to your wrapper.log file, not your console. If you want it to go to your Gateway console, try using a logger. For example:

logger = system.util.getLogger("mylogger")

Maybe writing to the tag is not working because you are not specifying the SQLTags provider in your tag path. Try this:

system.tag.write("[default]TestTag", 3)

You will notice that Alarm Notification Pipelines are under “Global” in the Project Browser in the designer. This means that Alarm Notification Pipelines do not run in a project and so do not have access to the default properties of projects, and so cannot use the default tag provider on the project.

Also, Alarm Notifications Pipelines execute on the Ignition Gateway, not in the designer – so the scripts run in the Gateway, not in your designer, so print statements don’t run in the designer so you won’t see the results in the designer console. Perhaps you already knew this and were looking at the Gateway console, but print statements don’t output there either, they output to the wrapper.log file on the Ignition server.


Thanks, it works!