2.0.5 • Published 3 years ago

node-onvif-events v2.0.5

Weekly downloads
9
License
ISC
Repository
github
Last release
3 years ago

node-onvif-events

node-onvif-events was created during a LaCETI Cin UFPE project where it was necessary to detect security cameras movements and communicate with iot devices.

NPM

If you like this project you can support me.

Installation

    $ npm install --save node-onvif-events
    $ yarn add node-onvif-events

Tested Cameras

the library must be compatible with any camera that works with onvif protocol and has motion detection support.

see the list of tested models, if your camera worked and is not in this list please open it issue and i will add it.

BrandModel
Hiseeu50X10_32M
Gadinan50X10_32M
OEM50X10_32M
IntelbrasVIP 1220 D G3

Typescript Example

import { MotionDetector, Options } from 'node-onvif-events';

const options: Options = {
  id: 1,                      // Any number id
  hostname: '192.168.0.160',  // IP Address of device
  username: 'admin',          // User
  password: 'password',       // Password
  port: 80,                   // Onvif device service port
};

const startMotion = async () => {
  const detector = await MotionDetector.create(options.id, options);
  console.log(new Date(), '>> Motion Detection Listening!');
  detector.listen((motion) => {
    if (motion) {
      console.log(new Date(), '>> Motion Detected');
    } else {
      console.log(new Date(), '>> Motion Stopped');
    }
  });
};

startMotion();

Javascript Example

const onvifEvents = require("node-onvif-events");

let options = {
  id: 1,
  hostname: '192.168.0.160',
  username: 'admin',
  password: 'password',
  port: 80
};

const startMotion = async () => {
  const detector = await onvifEvents.MotionDetector.create(options.id, options);
  console.log(new Date(), '>> Motion Detection Listening!!');
  detector.listen((motion) => {
    if (motion) {
      console.log(new Date(), '>> Motion Detected');
    } else {
      console.log(new Date(), '>> Motion Stopped');
    }
  });
}

startMotion();

output

2021-05-03T23:06:17.280Z >> Motion Detection Listening!
2021-05-03T23:06:26.471Z >> Motion Detected
2021-05-03T23:06:29.350Z >> Motion Stopped
2021-05-03T23:06:33.372Z >> Motion Detected

Contributors

2.0.3

3 years ago

2.0.2

3 years ago

2.0.5

3 years ago

2.0.4

3 years ago

2.0.1

3 years ago

2.0.0

3 years ago

1.0.4

4 years ago

1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago