Airthings Consumer API
    Preparing search index...

    Class AirthingsClient

    The Airthings for Consumer API provides secure and authorized access for Airthings consumers to retrieve the latest data from their Airthings air quality monitors. Leveraging HTTPS and OAuth for enhanced security, this API empowers users to seamlessly access real-time information from their Airthings devices, gaining valuable insights into the air quality within their environments.

    Index

    Constructors

    Methods

    • List all accounts the current user is member of

      Returns Promise<Accounts>

      Lists all accounts the current user is member of. The data returned by this endpoint changes when a user is added or removed from business accounts. It is safe to assume that the accountId remains constant for Consumer users. The accountId returned by this endpoint is used to fetch the devices and sensors from the other endpoints.

      AirthingsError If the request fails

    • Get all devices connected to a user

      Returns Promise<Devices>

      List all devices (and their sensor abilities) connected to a user’s account. The data returned by this endpoint changes when a device is registered, unregistered or renamed.

      AirthingsError If the request fails

      const devicesResponse = await client.getDevices();
      devicesResponse.devices.forEach((device) => {
      console.log(device);
      });
    • Get sensors for a set of devices

      Parameters

      • unit: SensorUnits

        The units type sensor values will be returned in, metric or imperial

      • Optionalsn: string[]

        An optional list of serial numbers to filter the results

      Returns Promise<SensorResults>

      Get sensors for a set of devices. The response will contain the latest sensor values for the devices. The sensor values are updated depending on the device types sampling rate. It is recommended to poll the API at a regular interval to get the latest sensor values. The response will be paginated with a maximum of 50 records per page.

      AirthingsError If the request fails

      const sensorsResponse = await client.getSensors(SensorUnits.Imperial);
      sensorsResponse.results.forEach((sensor) => {
      console.log(sensor);
      });