Hierarchy

Constructors

Methods

  • Delete data from device

    Parameters

    Returns Promise<string>

    Example

    const myDevice = new Device({ token: "my_device_token" });

    const result = await myDevice.deleteData({
    query: "last_item",
    variable: "humidity",
    value: 10
    });
  • Edit data in a Mutable-type device.

    Parameters

    • data: DataEdit | DataEdit[]

      Array or object with the data to be edited, each object with the data's ID.

    Returns Promise<string>

    Success message with the amount of data items updated.

    Example

    const myDevice = new Device({ token: "my_device_token" });

    const result = await myDevice.editData({
    id: "id_of_the_data_item",
    value: 123,
    time: "2022-04-01 12:34:56",
    location: { lat: 42.2974279, lng: -85.628292 },
    });
  • Experimental

    Get Data Streaming

    Parameters

    Returns AsyncGenerator<Data[], void, unknown>

    Example

    const myDevice = new Device({ token: "my_device_token" });

    for await (const items of myDevice.getDataStreaming()) {
    console.log(items);
    }
  • Get paronlyUnReameters from device

    Parameters

    • status: "all" | "onlyUnRead" | "onlyRead"

    Returns Promise<Required<ConfigurationParams>[]>

    Example

    const myDevice = new Device({ token: "my_device_token" });

    const result = await myDevice.getParameters();
  • Get information about the current device

    Returns Promise<DeviceItem>

    Example

    const myDevice = new Device({ token: "my_device_token" });

    const result = await myDevice.info();
  • Send data to device

    Parameters

    • data: DataCreate | DataCreate[]

      An array or one object with data to be send to TagoIO using device token

    Returns Promise<string>

    amount of data added

    Example

    const myDevice = new Device({ token: "my_device_token" });

    const result = await myDevice.sendData({
    variable: "temperature",
    unit: "F",
    value: 55,
    time: "2015-11-03 13:44:33",
    location: { lat: 42.2974279, lng: -85.628292 },
    });
  • Experimental

    Stream data to device

    Parameters

    • data: DataCreate[]

      An array or one object with data to be send to TagoIO using device token

    • options: Omit<OptionsStreaming, "neverStop">

      Stream options

    Returns Promise<string>

    Example

    const myDevice = new Device({ token: "my_device_token" });

    const data = [
    {
    variable: "temperature",
    unit: "F",
    value: 55,
    time: "2015-11-03 13:44:33",
    location: { lat: 42.2974279, lng: -85.628292 },
    },
    {
    variable: "temperature",
    unit: "F",
    value: 53,
    time: "2015-11-03 13:44:33",
    location: { lat: 43.2974279, lng: -86.628292 },
    },
    // ...
    ];

    const result = await myDevice.sendDataStreaming(data, {
    poolingRecordQty: 1000,
    poolingTime: 1000,
    });
  • Mark parameter as read

    Parameters

    • parameterID: string

      Parameter identification

    Returns Promise<string>

    Example

    const myDevice = new Device({ token: "my_device_token" });

    const result = await myDevice.setParameterAsRead("parameter_id");