Class Device

Hierarchy

Index

Constructors

constructor

Properties

batch

batch: Batch = new Batch(this.params)

Methods

deleteData

  • deleteData(queryParams?: DataQuery): Promise<string>
  • Delete data from device

    example
    const myDevice = new Device({ token: "my_device_token" });
    
    const result = await myDevice.deleteData({
      query: "last_item",
      variable: "humidity",
      value: 10
    });

    Parameters

    Returns Promise<string>

getData

  • Get data from TagoIO Device.

    example
    const myDevice = new Device({ token: "my_device_token" });
    
    const result = await myDevice.getData({
      query: "last_item",
      variable: "humidity",
    });

    Parameters

    • Optional queryParams: DataQuery

      Object with query params

    Returns Promise<Data[]>

    An array of TagoIO registers

getParameters

  • Get parameters from device

    example
    const myDevice = new Device({ token: "my_device_token" });
    
    const result = await myDevice.getParameters();

    Parameters

    • Optional onlyUnRead: boolean

      set true to get only unread parameters

    Returns Promise<ConfigurationParams[]>

info

  • Get information about the current device

    example
    const myDevice = new Device({ token: "my_device_token" });
    
    const result = await myDevice.info();

    Returns Promise<DeviceInfo>

sendData

  • Send data to device

    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 },
    });

    Parameters

    • data: DataToSend | DataToSend[]

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

    Returns Promise<string>

setParameterAsRead

  • setParameterAsRead(parameterID: GenericID): Promise<string>
  • Mark parameter as read

    example
    const myDevice = new Device({ token: "my_device_token" });
    
    const result = await myDevice.setParameterAsRead("parameter_id");

    Parameters

    • parameterID: GenericID

      Parameter identification

    Returns Promise<string>