Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to handle events coming from a notification object? #75

Open
cemremengu opened this issue Dec 15, 2017 · 6 comments
Open

How to handle events coming from a notification object? #75

cemremengu opened this issue Dec 15, 2017 · 6 comments

Comments

@cemremengu
Copy link

As the title says, if I setup a bacnet server and set the notification object in my controller to forward the messages to my server, how do I handle those events?

I searched but couldnt see anything in the docs or code. Is it possible?

@fh1ch
Copy link
Owner

fh1ch commented Dec 27, 2017

Hi @cemremengu

I've just started recently to tackle the whole alarming and eventing topic (see here), as I don't have too much experience with it.

I'm not really sure, what BACNET service you mean with that, but I assume you either using eventNotifyConfirmed or eventNotifyUnconfirmed. If this is the case, it should (never tested outside of syntactical unit-tests) be supported (see here for confirmed and here for unconfirmed). It should looks something like this (for the unconfirmed type):

var bacnet = require('bacstack');

const client = new bacnet();

client.on('eventNotify', (package) => {
  console.log(`Received 'eventNotify' from device: ${package.address} - Payload:`);
  console.log(eventData);
});

Let me know if this helps.

Cheers

@cemremengu
Copy link
Author

Sorry for the late reply, I was on holidays

In order to be able to receive event notifications, I need to be able to assign a deviceId to my client, receive a whoIs request and reply with an iAm

How to do this is not very obvious from documentation and code (at least for me). Could you please provide some assistance if possible?

@fh1ch
Copy link
Owner

fh1ch commented Jan 8, 2018

Sorry for the late reply, I was on holidays

No worries, me too 😄

In order to be able to receive event notifications, I need to be able to assign a deviceId to my client, receive a whoIs request and reply with an iAm

This doesn't really sounds like "BACNET eventing" at all, but more like you try to implement a BACNET device, wich supports the whoIs / iAm service. Am I right with this assumption?

How to do this is not very obvious from documentation and code (at least for me). Could you please provide some assistance if possible?

There is currently no documentation for the service handling part of most functions (see https://github.com/fh1ch/node-bacstack#features), as there still marked as unstable. However, I've used those functions in one of my other projects (see https://github.com/fh1ch/node-bacstack-device/blob/master/index.js#L30), where I try to implement a BACNET device (server) in JavaScript.

@cemremengu
Copy link
Author

Yes, your assumption is correct. In order to receive event notifications, you need to register a device in automation server (controller). After that, you can select your device to receive events from a notification class. WhoIs/IAm is required at registration step for device discovery.

@Apollon77
Copy link

@cemremengu Did you managed it? It would be awesome if you could share your code and also maybe check if it works with https://github.com/BiancoRoyal/node-bacstack (which is an updated fork of this library). We also started to provide some example scripts ... maybe we could add such an event notify receiver there as example?

@cemremengu
Copy link
Author

Unfortunately, it has been a long time and I no longer work with the project 😞

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants