npm.io
0.4.2 • Published 2 years ago

@types/node-dht-sensor

Licence
MIT
Version
0.4.2
Deps
1
Size
5 kB
Vulns
0
Weekly
0
Stars
51.4K

Installation

npm install --save @types/node-dht-sensor

Summary

This package contains type definitions for node-dht-sensor (https://github.com/momenso/node-dht-sensor).

Details

Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node-dht-sensor.

index.d.ts

/// <reference types="node" />

export type DHT11 = 11;
export type DHT22 = 22;
export type SensorType = DHT11 | DHT22;

export interface SensorData {
    temperature: number;
    humidity: number;
}

export function initialize(type: SensorType, pin: number): boolean;
// for faked test values only
export function initialize(testOptions: { test: { fake: SensorData } }): void;

export function read(
    type: SensorType,
    pin: number,
    callback: (err: NodeJS.ErrnoException | null, temperature: number, humidity: number) => void,
): void;
export function read(type?: SensorType, pin?: number): SensorData;

export function setMaxRetries(maxRetries: number): void;

export namespace promises {
    function initialize(type: SensorType, pin: number): boolean;
    function initialize(testOptions: { test: { fake: SensorData } }): void;
    function readSync(type?: SensorType, pin?: number): SensorData;
    function read(type?: SensorType, pin?: number): Promise<SensorData>;
    function setMaxRetries(maxRetries: number): void;
}

Additional Details

  • Last updated: Tue, 07 Nov 2023 0939 GMT
  • Dependencies: @types/node

Credits

These definitions were written by Manuel Schächinger.