node-opcua / node-opcua

Unlocking the Full Potential of OPC UA with Typescript and NodeJS - http://node-opcua.github.io/
MIT License
1.49k stars 481 forks source link

EventFilter Error after updating from 0.0.65 version #384

Closed awadekaustubh closed 6 years ago

awadekaustubh commented 7 years ago

Hi, I have successfully instantiated the alarm. But whenever the alarm is raised I am getting following error.

func readValueAsync has failed
 stack TypeError: Cannot read property 'length' of null
    at extractEventField (F:\opcua\node_modules\node-opcua-service-filter\src\tools_event_filter.js:200:32)
    at Array.map (native)

How to resolve the issue? Also, how to get the change event on occurrence of any event? any sample code if provided will be helpful.

I'm submitting a ... (check one with "x")

Current behavior

var addressSpace = opcserver.engine.addressSpace;
        addressSpace.installAlarmsAndConditionsService();
        var tankLevel = opcserver.engine.addressSpace.findNode("ns=2;s=d1_hr1");

        var exclusiveLimitAlarmType = addressSpace.findEventType("ExclusiveLimitAlarmType");
        assert(exclusiveLimitAlarmType != null);
        var tankLevelCondition = addressSpace.instantiateExclusiveLimitAlarm(exclusiveLimitAlarmType,{
           // componentOf:     tank,
            conditionSource: tankLevel,
            browseName:      "TankLevelCondition",
            optionals: [
                "ConfirmedState", "Confirm" // confirm state and confirm Method
            ],
            inputNode:       tankLevel,   // the variable that will be monitored for change
            highHighLimit:   200,
            highLimit:       170,
            lowLimit:        70,
            lowLowLimit:     55
        });

        opcserver.tankLevelCondition = tankLevelCondition;

When above piece of code is executed and alarm conditions are reached, it throws the mentioned error.

Expected behavior

I want a function which gets called when any event is called and I want the event details, so that I can call sms/email functionality to alert the users.

Minimal reproduction of the problem with instructions

  1. create and start the opc server.
  2. instantiate the alarm using pasted code
  3. Exception is thrown when limits of the values are crossed . ...

What is the motivation / use case for changing the behavior?

I am trying to create alarm functionality which will monitor the modbus device values and trigger the required function like sms/email.

Please tell us about your environment:

I have used jsmodbus to create a modbus device and read the values from the holding registers. This functionality is working fine for data monitoring. To test it, I am using Rsim simulator for values simulation.

Hope I have supplied enough information, please let me know if further more inputs are required. Thanks in advance.

erossignon commented 7 years ago

@awadekaustubh thank you for filling the template. For the record, could you also describe the client application (name, vendor, version etcc) you're are using to connect to your node-opcua server ? On my side I have managed to reproduce your behavior with the Prosys OPCUAClient but not with the UAExpert Client.

awadekaustubh commented 7 years ago

@erossignon I am using Prosys OPCUAClient to test this. When can I expect this Bug fix?