I am trying to use the alarmActive tag event to generate a custom e-mail. When I try to use properties of the alarmEvent object I get an error.
Here is my code:
eventTime = system.date.format(system.date.now(), 'h:m:s a')
displayPath = alarmEvent.displayPath
emailBody = "<b>" + alarmName + "</b> on <b>" + displayPath + "</b> went into alarm at " + eventTime + "."
recipients = ["ZZZZ"]
system.net.sendEmail(smtp="XXXX", fromAddr="YYYY", subject="Ignition Alarm Notification", body=emailBody, to=recipients, html=1)
And here is the error:
Error executing tag event script: Traceback (most recent call last): File “”, line 4, in alarmActive TypeError: cannot concatenate ‘str’ and ‘com.inductiveautomation.ignition.common.StringPath’ objects (this is the emailBody = line).
It appears that alarmEvent.displayPath is not a string. What is it and how do I make it a string?