TagoIO SDK for JavaScript and TypeScript
    Preparing search index...

    Class Devices

    Hierarchy

    Index

    Constructors

    Methods

    • Parameters

      • deviceID: string

      Returns Promise<string>

      Deletes a device from your application.

      If receive an error "Authorization Denied", check policy Device / Delete in Access Management.

      const result = await Resources.devices.delete("device-id-123");
      console.log(result); // Successfully Removed
    • Experimental

      Parameters

      • deviceID: string
      • chunkID: string

      Returns Promise<string>

      Deletes a chunk from a immutable device.

      If receive an error "Authorization Denied", check policy Device / Manage chunks in Access Management.

      const result = await Resources.devices.deleteChunk("device-id-123", "chunk-id-123");
      console.log(result); // Chunk chunk-id-123 deleted
    • Parameters

      • deviceId: string
      • OptionalqueryParams: DataQuery

      Returns Promise<string>

      Delete data records in a mutable device using the profile token and device ID.

      See the example to understand how to use this method properly to have full control on what to delete.

      ! If query parameters are empty, last 15 data for the device will be deleted.

      If receive an error "Authorization Denied", check policy Device / Delete data in Access Management.

      const result = await Resources.devices.deleteDeviceData("device-id-123", {
      ids: ["record-id-1", "record-id-2"]
      });
      console.log(result); // 1 Data Removed
    • Parameters

      • deviceID: string
      • deviceObj: Partial

      Returns Promise<string>

      Modifies properties of an existing device.

      If receive an error "Authorization Denied", check policy Device / Edit in Access Management.

      const result = await Resources.devices.edit("device-id-123", {
      name: "Updated Device Name",
      active: true
      });
      console.log(result); // Successfully Updated
    • Parameters

      Returns Promise<string>

      Edit data records in a mutable device using the profile token and device ID.

      The updatedData can be a single data record or an array of records to be updated, each of the records must have the id of the record and the fields to be updated.

      If receive an error "Authorization Denied", check policy Device / Edit data in Access Management.

      const result = await Resources.devices.editDeviceData("myDeviceId", {
      id: "idOfTheRecord",
      value: "new value",
      unit: "new unit"
      });
      console.log(result); // 1 item(s) updated
    • Parameters

      • deviceId: string
      • OptionalqueryParams: DataQuery

      Returns Promise<Data[]>

      Retrieves data from all variables in the device.

      If receive an error "Authorization Denied", check policy Device / Get data in Access Management.

      const data = await Resources.devices.getDeviceData("device-id-123", {
      qty: 10,
      variables: ["temperature"]
      });
      console.log(data); // [ { id: 'data-id-123', value: 55, variable: 'temperature' ... } ]
    • Parameters

      • deviceID: string

      Returns Promise<DeviceInfo>

      Retrieves detailed information about a specific device.

      If receive an error "Authorization Denied", check policy Device / Access in Access Management.

      const deviceInfo = await Resources.devices.info("device-id-123");
      console.log(deviceInfo); // { active: true, bucket: { id: 'device-id-123', name: 'My Device' } ... }
    • Type Parameters

      Parameters

      • OptionalqueryObj: T

      Returns Promise<
          DeviceListItem<
              T["fields"] extends (
                  | "updated_at"
                  | "profile"
                  | "connector"
                  | "network"
                  | "name"
                  | "active"
                  | "created_at"
                  | "bucket"
                  | "id"
                  | "description"
                  | "tags"
                  | "visible"
                  | "last_input"
                  | "type"
                  | "payload_decoder"
                  | "rpm"
              )[]
                  ? any[any][number]
                  : "name"
                  | "id",
          >[],
      >

      Lists all devices from your application with pagination support.

      If receive an error "Authorization Denied", check policy Device / Access in Access Management.

      const list = await Resources.devices.list({
      page: 1,
      fields: ["id", "name"],
      amount: 10,
      orderBy: ["name", "asc"]
      });
      console.log(list); // [ { id: '123', name: 'Device #1' ...}, { id: '456', name: 'Device #2' ...} ]
    • Parameters

      Returns AsyncGenerator<
          DeviceListItem<
              | "updated_at"
              | "profile"
              | "connector"
              | "network"
              | "name"
              | "active"
              | "created_at"
              | "bucket"
              | "id"
              | "description"
              | "tags"
              | "visible"
              | "last_input"
              | "type"
              | "payload_decoder"
              | "rpm",
          >[],
          void,
          unknown,
      >

      Gets a streaming list of devices from the application.

      If receive an error "Authorization Denied", check policy Device / Access in Access Management.

      for await (const items of await Resources.devices.listStreaming({ name: "*sensor*" })) {
      console.log(items);
      }
    • Parameters

      • deviceID: string
      • paramID: string

      Returns Promise<string>

      Removes a parameter from a device.

      If receive an error "Authorization Denied", check policy Device / Edit in Access Management.

      const result = await Resources.devices.paramRemove("device-id-123", "param-id-123");
      console.log(result); // Successfully Removed
    • Experimental

      Parameters

      Returns Promise<string>

      Streams data to a device in chunks.

      If receive an error "Authorization Denied", check policy Device / Send data in Access Management.

      const result = await Resources.devices.sendDeviceDataStreaming("device-id-123",
      [{
      variable: "temperature",
      value: 55,
      unit: "F",
      }],
      { poolingRecordQty: 1000 }
      );
      console.log(result);
    • Parameters

      • token: string

      Returns Promise<string>

      Deletes a device token.

      If receive an error "Authorization Denied", check policy Device / Token access in Access Management.

      const result = await Resources.devices.tokenDelete("token-123");
      console.log(result); // Token Successfully Removed
    • Type Parameters

      Parameters

      • deviceID: string
      • OptionalqueryObj: T

      Returns Promise<
          DeviceTokenDataList<
              T["fields"] extends (keyof DeviceTokenData)[]
                  ? any[any][number]
                  : "name" | "token" | "permission",
          >[],
      >

      Lists all tokens for a device with pagination support.

      If receive an error "Authorization Denied", check policy Device / Token access in Access Management.

      const tokens = await Resources.devices.tokenList("device-id-123", {
      page: 1,
      fields: ["name", "token"],
      amount: 10
      });
      console.log(tokens); // [ { name: 'Default', token: 'token-id-123', expire_time: 'never' } ]