These are chat archives for node-opcua/node-opcua

4th
Sep 2017
patrickl92
@patrickl92
Sep 04 14:16
Hi, i am using node-opcua and i have a problem creating alarms. I instantiated an alarm with a custom type and the events are raised as expected but the alarms are not shown in the alarms list of UAExpert. Does anyone have an idea what could be mising?
var alarmSourceTime = new Date(); // From external source

var alarmNode = addressSpace.instantiateAlarmCondition("MachineAlarmType", {
    conditionName: "Error",
    conditionClass: "ProcessConditionClassType",
    conditionSource: parentNode,
    inputNode: parentNode,
    componentOf: parentNode,
    browseName: "MyFirstAlarm"
}, []);

var branch: any = alarmNode.currentBranch();

alarmNode.setSourceName("HMI");
branch._set_var("sourceName", "String", "HMI");

alarmNode.activateAlarm();

branch.setMessage("Alarm Message #1");
branch.setSeverity(800);
branch.setTime(alarmSourceTime);
branch.setReceiveTime(new Date());
branch.setAckedState(true);

branch.renewEventId();
alarmNode.raiseConditionEvent(branch);
events.png
alarms.png