[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;
more
(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 system.net.sendEmail, and the version of Ignition you are using, I can help you get that straightened out.
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… )
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.