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

@bouzuya/irkit

v1.0.0

Published

An IRKit Device / Internet HTTP API wrapper for Node.js

Downloads

7

Readme

node-irkit

An IRKit Device / Internet HTTP API wrapper for Node.js.

Installation

npm install @bouzuya/irkit

Usage

See example/.

IRKitDevice (IRKit Device HTTP API)

import { IRKitDevice, Message, Security } from '@bouzuya/irkit';

const main = async () => {
  // options.ip or `process.env.IRKIT_DEVICE_IP`
  const device = new IRKitDevice({ ip: '192.168.1.1' });

  // IRKitDevice.prototype.getMessages()
  // GET /messages
  const message: Message = await device.getMessages();
  if (message !== null) {
    console.log(message);
    // {"format":"raw","freq":38,"data":[18031, ...]}
  }

  // IRKitDevice.prototype.postMessages()
  // POST /messages
  await device.postMessages({
    format: 'raw',
    freq: 38,
    data: [ /* ... */ ]
  });

  // IRKitDevice.prototype.postKeys()
  // POST /keys
  const keys = await device.postKeys();
  console.log(keys);
  // {"clienttoken":"XXXXXXXXXXXXXXXXXXXXXXXXXXXXX"}

  // IRKitDevice.prototype.postWifi()
  // POST /wifi
  await device.postWifi({
    devicekey: /* ... */,
    password: /* ... */,
    security: Security.WPA_WPA2,
    ssid: /* ... */
  });
};

main();

IRKit (IRKit Internet HTTP API)

import { IRKit, IRKitDevice } from '@bouzuya/irkit';

const main = async () => {
  const device = new IRKitDevice({ ip: '192.168.1.1' });
  const client = new IRKit();

  // IRKit.prototype.postKeys()
  // POST /1/keys
  const { clienttoken } = await device.postKeys();
  const keys = await client.postKeys({ clienttoken });
  console.log(keys);
  // { deviceid: 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX', clientkey: 'XXXXXXXXXXXXXXXXXXXXXXX' }

  // IRKit.prototype.postMessages()
  // POST /1/messages
  const messages = await client.postMessages({
    clientkey: keys.clientkey,
    deviceid: keys.deviceid,
    message: {
      format: 'raw',
      freq: 38,
      data: [ /* ... */ ]
    }
  });

  // IRKit.prototype.getMessages()
  // GET /1/messages
  const messages = await client.getMessages({
    clientkey: keys.clientkey
  });
  if (messages !== null) {
    console.log(messages);
    // {"message":{"format":"raw","freq":38,"data":[18031,...]},"hostname":"IRKitD2A4","deviceid":"FBEC7F5148274DADB608799D43175FD1"}
  }

  // IRKit.prototype.postClients()
  // POST /1/clients
  const clients = await client.postClients({
    apikey: keys.apikey
  });
  console.log(clients);
  // {"clientkey":"XXXXXXXXXXXXXXXXXXXXXXXXXXXXX"}

  // IRKit.prototype.postDevices()
  // POST /1/devices
  const devices = await client.postDevices({
    clientkey: keys.clientkey
  });
  console.log(devices);
  // {"devicekey":"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX","deviceid":"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"}

  // IRKit.prototype.postDoor()
  // POST /1/door
  const door = await client.postDoor({
    clientkey: keys.clientkey,
    deviceid: devices.deviceid
  });
  console.log(door);
  // {"hostname":"IRKitXXXX"}


  // IRKit.prototype.postApps()
  // POST /1/door
  const app = await client.postApps({
    email: '[email protected]'
  });
  console.log(app);
  // {"message":"You will receive an email shortly, please click the URL in it to get an apikey"}

};

main();

APIs

IRKit Device HTTP API

  • GET /messages
  • POST /messages
  • POST /keys
  • POST /wifi

IRKit Internet HTTP API

  • POST /1/keys
  • POST /1/messages
  • GET /1/messages
  • POST /1/clients
  • POST /1/devices
  • POST /1/door
  • POST /1/apps

Badges

npm version Travis CI

License

src/irkit-device-key-serializer.ts

MIT mash

others

MIT

Author

bouzuya <[email protected]> (http://bouzuya.net)