Script in Alarm Pipeline

Hi everybody,

In Ignition 7.7, I would like to send an email to only one user of my on-call roster according to a tag which was modified.

For example :

if tag1 >10 --> send email to ""
if tag2 >10 -->send email to “”

Can I do it in a script block ?

I tried “” function in a script block but I failed.

Thanks for your help,

What kind of error message did you get?

My error message below :

[quote]16:30:40 BlockEvaluationContext [Pipeline: New Pipeline] Error executing scriptable block.

Traceback (most recent call last):
File “function:handleAlarm”, line 2, in handleAlarm

java.lang.ClassCastException: java.lang.ClassCastException: Cannot coerce value ‘myaddress’ into type: class [Ljava.lang.String;

Caused by: java.lang.ClassCastException: Cannot coerce value ‘myaddress’ into type: class [Ljava.lang.String;
(I) 16:30:32 Pipeline [name=New Pipeline,version=158] Alarm pipeline started.[/quote]

The exception is telling you that it’s expecting a String where you are using myaddress, but you are not giving it something it can turn into a string. If you post your declaration of myaddress (sanitized), the line where you are calling, and the version of Ignition you are using, I can help you get that straightened out.

My script :

def handleAlarm(event):"","","test" ,"test" ,0 ,"")

The ‘to’ address should be a list, even though it only has one item in it. Try [code]def handleAlarm(event):“”,"",“test” ,“test” ,0 ,[“”])[/code]

Since I fail so badly in scripting, a way to get around this would be:

In the gateway, Configure>Alarming>on call roster give each user a separate roster (contact1 and contact2)

In your project create a separate alarm notification pipeline for each contact (CONTACT1 and CONTACT2)

In your tag editor create a new alarm in each tag. Ex: Tag1 Mode: above setpoint, setpoint = 10
Then your notification active pipeline would be CONTACT 1

So each time your setpoint for that tag went above 10, it would send the notification to the CONTACT1 pipeline Where you can specify an e-mail notification be sent to your contact1 roster.

In Ignition 7.8, you won’t have to create different pipelines, because the rosters are expressions. (Assuming you’re more comfortable with expressions than scripting… )

I’m still on 7.7, expressions are much more user friendly for me. Looking forward to upgrading. Thanks!


It’s better to put the sendEmail function in a Tag Script Event > AlarmActive. You can send email to all recipients you want and add your conditions.
I did it and it works perfectly.