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

ialarm

v0.6.7

Published

A node library to control iAlarm/antifurtocasa365, Casasicura/Siqura and other chinese 'TCP IP' alarm system like Meian ST-IVCGT clones and Emooluxr

Downloads

15

Readme

node-ialarm

A node library to control Meian TCP alarms and other chinese 'TCP IP' alarm system (Focus, Emooluxr, iAlarm/Antifurto365, Casasicura, etc)

inspired by these projects

  • https://github.com/RyuzakiKK/pyialarm
  • https://github.com/wildstray/meian-client

CLI

npx meian-cli

will print the help:

  -c, --commands  List of commands to execute. Can contain args: SetByWay(2,fals
                  e)                                       [vettore] [richiesto]
  -s, --host      ip of the alarm                                    [richiesto]
  -n, --port      TCP port                         [numero] [predefinito: 18034]
  -u, --username  Username required for logging in         [stringa] [richiesto]
  -p, --password  Password required for logging in         [stringa] [richiesto]
  -z, --zones     Number of configured zones         [numero] [predefinito: 128]
  -o, --output    JSON file where to dump the output of the commands   [stringa]

Basic example:

npx meian-cli -c GetByWay -s 192.168.1.81 -u MyUsername -p MyPassword 

Example with 40 zones, multiple commands and dump to file:

npx meian-cli -c GetNet -c GetAlarmStatus -c GetZone -c GetByWay -c SetByWay(1,true) -c GetLogs -s 192.168.1.81 -u MyUsername -p MyPassword -z 40 -o /MyFolder/dump.json

N.B. with bash you may need to write commands with quotes

npx meian-cli -c "SetByWay(1,true)" -s 192.168.1.81 -u MyUsername -p MyPassword 

aliases

npx ialarm-cli 

Library Installation

npm install node-ialarm

Commands

See Commands

Usage

import { MeianSocket } from 'ialarm'


const socket = MeianSocket('192.168.1.81', 18034, 'username', 'password', 'debug', 40)

/**
   * ready to send commands
   */
socket.onConnected(async (connectionResponse) => {
  console.log(`logged in (${connectionResponse})`)
})

// command
socket.onResponse(async (commandResponse) => {
  console.log(JSON.stringify(commandResponse))
})

// push events
socket.onPush(async (pushResponse) => {
  console.log(`Received push: ${JSON.stringify(pushResponse)}`)
})

socket.onDisconnected(async (disconnectionResponse) => {
  console.log(`disconnected (type: ${disconnectionResponse})`)
})

socket.onError(async (error) => {
  console.log(`Error ${error.message} - ${JSON.stringify(error.stack)}`)
})

/**
 * ready to send commands
 */
socket.onConnected(async (connectionResponse) => {
  console.log(`logged in (${connectionResponse})`)
})

// connect
socket.connect()

// wait for connection before sending data
const polling = setInterval(async () => {
  if (socket.connection.status.isReady()) {
    clearInterval(polling)

    const commands = ['GetNet', 'GetAlarmStatus', 'GetByWay']
    const commandsArgs = [[], []. [1]]
    console.log(`Testing ${JSON.stringify(current)} (${JSON.stringify(commandsArgs)})...`)

    // send commands
    await socket.executeCommand(commands, commandsArgs)

  } else {
    console.log(`Connection not ready yet for receiving data - ${socket.connection.status.text()}...will try again later..`)
  }
}, 1000)


// delay disconnection for testing purposes
setTimeout(() => {
  socket.disconnect()
}, 120000)