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

ts-xbee-api

v2.0.1

Published

Node.js and Chrome communicate with XBee/ZigBee devices in API mode

Downloads

7

Readme

ts-xbee-api

A user-friendly interface to Digi's XBee line of RF modules. This is made up of two parts:

  • a library for parsing and building XBee frames, especially in association with Node streams, such as those provided by the serialport package.
  • a high-level API for interacting with XBee modules, including a simple API for sending and receiving data.

Originally based on xbee-api, but has been extensively modified, especially as of v2.0.0.

GETTING STARTED

Installation: npm install ts-xbee-api

import { XBee } from 'ts-xbee-api';

const xbee = await XBee.discover('/dev/ttyUSB0', [9600, 115200]);
const routerAddress = await xbee.address();
const remoteAddress = '0013A20040B3B3B3';
await xbee.transmit(Uint8Array.from([0x01, 0x02, 0x03]), remoteAddress);

SUPPORTED FIRMWARES AND DEVICES

This module supports the 802.15.4 and ZigBee (including ZNet) protocol stacks.

From the XBee family, Series 1 (802.15.4) and Series 2 (ZNet 2.5 and ZigBee) modules are supported, since they come with firmwares talking either one of these stacks.

These documents are used as reference: 90000976.pdf (for Series 2) and 90000982.pdf (for Series 1). Some frame types are 802.15.4, ZNet or ZigBee specific. Be sure to use the correct ones for your module (as described in the documents and the list below). Also check out this utility from Digi.

Modules must run in API mode. Both AP=1 (without escaping) and AP=2 (with escaping) modes are supported (set the api_mode parameter accordingly).

Since ZigBee is more robust and offers more features than ZNet (none of which are yet implemented here, though!), you might be interested in upgrading your Series 2 modules from ZNet 2.5 to ZigBee: upgradingfromznettozb.pdf.

SUPPORTED FRAME TYPES

The following frame types are implemented:

  • 0x00: TX (Transmit) Request: 64-bit address (802.15.4)
  • 0x01: TX (Transmit) Request: 16-bit address (802.15.4)
  • 0x08: AT Command (802.15.4, ZNet, ZigBee)
  • 0x09: AT Command Queue Parameter Value (802.15.4, ZNet, ZigBee)
  • 0x17: Remote Command Request (802.15.4, ZNet, ZigBee)
  • 0x21: Create Source Route (ZigBee)
  • 0x80: RX (Receive) Packet: 64-bit Address (802.15.4)
  • 0x81: RX (Receive) Packet: 16-bit Address (802.15.4)
  • 0x82: RX (Receive) Packet: 64-bit Address IO (802.15.4)
  • 0x83: RX (Receive) Packet: 16-bit Address IO (802.15.4)
  • 0x88: AT Command Response (802.15.4, ZNet, ZigBee)
  • 0x89: TX (Transmit) Status (802.15.4)
  • 0x8A: Modem Status (802.15.4, ZNet, ZigBee)
  • 0x97: Remote Command Response (802.15.4, ZNet, ZigBee)
  • 0x10: ZigBee Transmit Request (ZNet, ZigBee)
  • 0x11: Explicit Addressing ZigBee Command Frame (ZNet, ZigBee)
  • 0x8B: ZigBee Transmit Status (ZNet, ZigBee)
  • 0x90: ZigBee Receive Packet (AO=0) (ZNet, ZigBee)
  • 0x91: ZigBee Explicit Rx Indicator (AO=1) (ZNet, ZigBee)
  • 0x92: ZigBee IO Data Sample Rx Indicator (ZNet, ZigBee)
  • 0x94: XBee Sensor Read Indicator (AO=0) (ZNet, ZigBee)
  • 0x95: Node Identification Indicator (AO=0) (ZNet, ZigBee)
  • 0xA1: Route Record Indicator (ZigBee)

NOT IMPLEMENTED YET

These (more esoteric) frame types have not been implemented yet, Open a new issue if you need something in particular:

  • 0x24: Register Joining Device (ZigBee)
  • 0xA0: Over-the-Air Firmware Update Status (ZigBee)
  • 0xA2: Device Authenticated Indicator (ZigBee)
  • 0xA3: Many-to-One Route Request Indicator (ZigBee)
  • 0xA4: Register Joining Device Status (ZigBee)
  • 0xA5: Join Notification Status (ZigBee)

Building

Run nx build new to build the library.

Running unit tests

Run nx test new to execute the unit tests via Jest.