npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

dahua_initializer

v1.1.3

Published

Automatic initialization for Dahua cameras

Downloads

6

Readme

Node package for automating Dahua :tm: camera initialization

This package provides an automatic way to initialize Dahua :tm: cameras via Puppeteer.

Usage

Installation

npm i dahua_initilizer

Usage

const dahuaInitializer = require('dahua_initializer')
dahuaInitializer.initialize(option, camera_config)

Option parameter

screenshots: default false

path: default '' (if !screenshots the field is ignored)

headless: default true

camera_config parameter

The camera_config field is a json object of the following form:

Camera initialization usually has various configuration screens:

    {
    	"ip": "192.168.1.108",
	"port": 80,
        "screens": [
            Object,
            Object
        ]
    }

ip defaults to 192.168.1.108 and port to 80.

Screen object is an array of actions:

    [
	{
	    "action": "click",
	    "selector": "#elementID"
        },
        {
	    "action": "fill",
	    "selector": "#elementID",
	    "text": "HelloWorld"
        },
        {
	    "action": "keypress",
	    "selector": "#elementID",
	    "key": "Enter"
	},
	{
	    "action": "delay",
	    "time": 200
	}
    ]

action: Will be performed sequentially. (Note! Before any forwarding to the next dialog complete all your actions.)

  • click: Simulate a mouse click event on the element
  • fill: This action expects text field. (Note! Generally, input element need to be clicked before filling.)
  • keypress: This action expects key field. At the present we only support Enter. (See Puppeteer docs. If you want to extend it :wink:)
  • delay: This action expects time field. Some fields need some time after the action is performed, for example the time synchronization. (time in ms).

Example

Complete example of camera_config for camera model:

{
  "ip": "192.168.1.108",
  "port": "80",
  "screens": [
    [
      {
        "action" : "click",
        "selector" : "#nation_select"
      },
      {"action" :  "fill",
        "selector": "#nation_select",
        "text" : "Spain"
      },
      {
        "action" : "keypress",
        "selector": "#nation_select",
        "key" : "Enter"
      },
      {
        "action" : "click",
        "selector": "#init_language"
      },
      {
        "action": "click",
        "selector": "#login_permission4 .u-dialog-foot a"
      }
    ],
    [
      {
        "action": "click",
        "selector": "#login_permission1 input[type=checkbox]"
      },
      {
        "action": "click",
        "selector": "#login_permission1 .u-dialog-foot a"
      }
    ],
    [
      {
        "action": "click",
        "selector": "#devinit_time_zone #syncPCBtn"
      },
      {
        "action": "delay",
        "time": 1000
      },
      {
        "action": "click",
        "selector": "#devinit_time_zone .u-dialog-foot a"
      }
    ],
    [
      {
        "action": "click",
        "selector": "#device_init input[name=newpwd]"
      },
      {
        "action": "fill",
        "selector": "#device_init input[name=newpwd]",
        "text": "password"
      },
      {
        "action": "click",
        "selector": "#device_init input[name=newpwdcfm]"
      },
      {
        "action": "fill",
        "selector": "#device_init input[name=newpwdcfm]",
        "text": "password"
      },
      {
        "action": "click",
        "selector": "#device_init #devInit_mail_enable"
      },
      {
        "action": "click",
        "selector": "#device_init .u-dialog-foot a"
      }
    ],
    [
      {
        "action": "click",
        "selector": "#login_permission2 .u-dialog-foot a"
      },
      {
        "action" : "delay",
        "time" : 200
      }
    ],
    [
      {
        "action": "click",
        "selector": "#login_permission3 .u-dialog-foot a"
      },
      {
        "action" : "delay",
        "time" : 200
      }
    ]
  ]
}

Tested cameras