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

@codingkiwi/airthings-wave-plus

v1.0.1

Published

A Node.js package for interacting with the Airthings Wave Plus device via Bluetooth, providing seamless data retrieval for humidity, temperature, radon levels, atmospheric pressure, carbon dioxide, and volatile organic compounds.

Downloads

13

Readme

Airthings Wave Plus NPM Package

Overview

The @codingkiwi/airthings-wave-plus NPM package is a convenient and easy-to-use tool for interacting with the Airthings Wave Plus device via Bluetooth. The package allows users to seamlessly connect to the Airthings Wave Plus, retrieve data, and disconnect as needed.

Installation

To install the package, run the following command:

npm install @codingkiwi/airthings-wave-plus

Usage

Importing the Package

import WavePlus from "@codingkiwi/airthings-wave-plus";

Creating an Instance

const wavePlus = new WavePlus();

You can also customize the discovery interval and timeout by passing options to the constructor:

const customOptions = {
    discoverInterval: 2000, // Custom discovery interval in milliseconds
    discoverTimeout: 15000, // Custom discovery timeout in milliseconds
};

const wavePlusWithCustomOptions = new WavePlus(customOptions);

Reading Data

Reading Once

const data = await wavePlus.readOnce();

This method connects to the device (if necessary), reads the data, and disconnects. It returns the retrieved data.

Continuous Reading

const continuousData = await wavePlus.read();

This method connects to the device (if necessary) and reads the data and keeps the bluetooth connection. It is useful for scenarios where you want to read data at regular intervals.

Connecting and Disconnecting

Connecting

await wavePlus.connect();

Connects to the Airthings Wave Plus device if necessary.

Disconnecting

await wavePlus.disconnect();

Disconnects from the Airthings Wave Plus device.

Note

The Airthings Wave Plus device delivers new data every 5 minutes. Keep this in mind when implementing continuous reading to avoid unnecessary connections.

Example

import WavePlus from "@codingkiwi/airthings-wave-plus";

async function getData() {
    const wavePlus = new WavePlus();

    try {
        const data = await wavePlus.read();
        console.log("Data:", data);
    } finally {
        await wavePlus.disconnect();
    }
}

getData();

/**
{
  humidity: 35.5,
  temperature: 16.49,
  radonStAvg: 35,
  radonLtAvg: 31,
  pressure: 970.32,
  co2: 539,
  voc: 48
}
*/

Feel free to customize the example based on your specific use case and requirements.

Debugging

For enhanced debugging capabilities, the @codingkiwi/airthings-wave-plus package integrates with the debug npm package under the namespace "airthings." To enable debugging output, set the DEBUG environment variable to "airthings" when running your application. For example:

DEBUG=airthings node your-app.js

This will activate debug messages specific to the @codingkiwi/airthings-wave-plus package, providing valuable insights into the internal processes, Bluetooth interactions, and overall functionality. Debugging can be particularly useful for troubleshooting and gaining a deeper understanding of the package's behavior. Explore the debug output to identify and resolve any issues during development or integration with your project.