Alarm Notification Manager

Hello !

I want to read available alarm notification profiles so Im using this script

from  com.inductiveautomation.ignition.gateway import IgnitionGateway
context = IgnitionGateway.get()
notificationList= context.getAlarmNotificationManager().getProfileNames()

this script returns nothing. So, I have read most of topics on this section Search results for 'import IgnitionGateway' - Inductive Automation Forum and I noticed that most of scripting uses all methods listed on this section GatewayContext. However I didn't find any method to read all alarm notification profiles.

Do you have any idea?

When you looked at the javadoc for the GatewayContext to find the .getAlarmNotificationManager() method, did you notice the return data type? Of AlarmManager? If you followed that link, it would show you what you would be able to use with the alarm manager object. (You were close.)

Hello pturmel, thank you your fast response

My dubt still there because on GatewayContext the .getAlarmNotificationManager() method is not listed. I only found .getAlarmManager() which doesn't have any method to get notification profile names.

But the method is on this package com.inductiveautomation.ignition.alarming.notification

How could I use this method that is not listed on GatewayContext?

Oh, I see. That's implemented by the alarm notification module. You'll have to get the module manager and request the alarm notification module by its ID string. Then examine the returned object (its gateway hook) to see what interfaces it exposes. (If you are lucky, the gateway hook is the alarm notification manager.)

1 Like

The hook class for the alarm notification module implements AlarmNotificationContext. So not quite directly, but pretty close.

Thank you for your feedback. Actually I'm not sure how to use a different context from GatewayContext

from com.inductiveautomation.ignition.alarming.notification import IgnitionGateway
context = IgnitionGateway.get()
notificationList= context.getProfileNames()

I belive I have to use a different class instead of IgnitionGateway but I couldn't find any :frowning:

IgnitionGateway is the instance class of GatewayContext. That interface defines a method getModule(moduleId) (or something like that, I'm on my phone). That method allows you reach "into" another module to ask it for it's hook class. If you provide the ID of the alarm notification module, you'll get an instance that has the methods listed on the Alarm notification context interface I linked above, which you could the use to get access to what you're looking for. Probably.

Not quite. It defines getModuleManager(), which I mentioned above. The module manager has getModule().

David, when dealing with the SDK, you have to explore. The GatewayContext that IgnitionGateway implements is the core of the system, and mostly exposes tools to get subsystems, which then sometimes have their own nested components.

{ When exploring you will sometimes encounter a java Interface that doesn't seem to show all possibilities, and doesn't list any implementations. That means the implementation details aren't public. Beware of such cases. }

1 Like

Thank you so much,

I have this script

stringID='com.inductiveautomation.alarm-notification'
from  com.inductiveautomation.ignition.gateway import IgnitionGateway
context = IgnitionGateway.get()
newContext= context.getModuleManager().getModule(stringID)
notificationProfiles=newContext.getAlarmNotificationManager().getProfileNames()
	

newContext returns: ModuleManagerImpl$LoadedModule[id="com.inductiveautomation.alarm-notification", state="RUNNING"]

I got the error log that org.python.core.PyException: AttributeError: 'com.inductiveautomation.ignition.gateway.modules.M' object has no attribute 'getAlarmNotificationManager'

Try

newContext= context.getModuleManager().getModule(stringID).getHook()

Or skip the module manager entirely; GatewayContext extends CommonContext so you can just use context.getModule(moduleId):
https://files.inductiveautomation.com/sdk/javadoc/ignition81/8.1.31/com/inductiveautomation/ignition/common/model/CommonContext.html#getModule(java.lang.String)

1 Like

Ah! That's the one that returns the hook directly.