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

node-reco

v1.0.0

Published

Reco LAN control API

Downloads

1

Readme

node-reco

Reco LAN control API

Install

npm install node-reco

Promise API

const Reco = require('node-reco');

/* 立刻打开电源 */
Reco.powerOn('192.168.29.66').then(() => {/.../});

/* 立刻关闭电源 */
Reco.powerOff('192.168.29.66').then(() => {/.../});

/* 延时1分钟后打开电源 */
Reco.powerOn('192.168.29.66', 1).then(() => {/.../});

/* 延时1分钟后关闭电源 */
Reco.powerOff('192.168.29.66', 1).then(() => {/.../});

/* 获取当前输出参数 */
Reco.info('192.168.29.66').then((info) => {console.log(info)});
//=> { I: 8, U: 23678, F: 4999, P: 74, PQ: 0, E: 22015, EQ: 0 }

/* 扫描192.168.29.xx网段内所有的Reco插座 */
Reco.discover("192.168.29.255").then((devs) => {console.log(devs)});
/*
=> [
  {
    ip: '192.168.29.66',
    mac: 'ACCF23484D70',
    sn: '040002298',
    res: 1,
    status: 1
  }
]
*/

类型定义

export interface RecoPowerInfo {
    /** 电流值 0.01A */
    I: number;
    /** 电压值 0.01V */
    U: number;
    /** 频率值 0.01Hz */
    F: number;
    /** 有功功率值 0.1W */
    P: number;
    /** 无功功率值 0 */
    PQ: number;
    /** 有功能量值 1WH */
    E: number;
    /** 无功能量值 0 */
    EQ: number;
}

export interface RecoDeviceInfo {
    /** 插座IP地址 */
    ip: string;
    /** 插座MAC地址 */
    mac: string;
    /** 设备序列号 */
    sn: string;
    /** 插座与远程复位器的连接状态 */
    res: number;
    /** 插座的状态 "1": ON ,"0": OFF */
    status: number;
}

/**
 * 立即或延时打开电源
 * @param ipaddr - 插座IP地址
 * @param delay - 延时执行(单位分钟),默认为0,表示立即执行
 * @param broad - 槽位号,默认为1
*/
export declare function powerOn(ipaddr?: string, delay?: number, broad?: number): Promise<string>;

/**
 * 立即或延时关闭电源
 * @param ipaddr - 插座IP地址
 * @param delay - 延时执行(单位分钟),默认为0,表示立即执行
 * @param broad - 槽位号,默认为1
*/
export declare function powerOff(ipaddr?: string, delay?: number, broad?: number): Promise<string>;

/**
 * 获取指定插座的电源输出参数
 * @param ipaddr - 插座IP地址
*/
export declare function info(ipaddr?: string): Promise<RecoPowerInfo>;

/**
 * 扫描指定网段内的插座
 * @param host - 插座IP地址或局域网广播地址
 * @param timeout - 扫描超时时间,默认500ms
 * @param max - 数组最大长度,默认65535个
*/
export declare function discover(host?: string, timeout?: number, max?: number): Promise<unknown>;

declare const _default: {
    powerOn: typeof powerOn;
    powerOff: typeof powerOff;
    info: typeof info;
    discover: typeof discover;
};
export default _default;