Nascent Political Miscreant
    Have ideas to improve npm?Join in the discussion! »

    node-onvif-events

    2.0.5 • Public • Published

    node-onvif-events

    Node Onvif Events


    An implementation of Node.js that detects the events of your camera that works with the onvif protocol. You can use this library to turn on a lamp, send notification to a device among others .. the possibilities are limitless! 🚀⚡️


    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.
    Buy Me A Coffee


    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.


    Brand Model
    Hiseeu 50X10_32M
    Gadinan 50X10_32M
    OEM 50X10_32M
    Intelbras VIP 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


    Rogério Luiz

    💻 🤔 💡 ⚠️

    Marvson Allan

    💻 🤔 👀

    Install

    npm i node-onvif-events

    DownloadsWeekly Downloads

    1

    Version

    2.0.5

    License

    ISC

    Unpacked Size

    16.9 kB

    Total Files

    14

    Last publish

    Collaborators

    • avatar