Use dataBackup
instead.
Generates and retrieves a new action from the Device
Object data to create new device
Schedule to export the Device's data to TagoIO Files.
Pass the chunkID
as parameter to backup data from Immutable devices.
Optional
chunkID: stringawait Resources.devices.dataBackup({
deviceID: "my-device-ID",
file_address: "/backups/$DEVICE$/$TIMESTAMP$",
headers: true,
});
Restore data to a device from a .csv
hosted in TagoIO Files.
await Resources.devices.dataRestore({ deviceID: "my-device-ID", file_address: "/backups/old-device-id/backup.csv" });
Delete data records in a 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.
Device ID.
Optional
queryParams: DataQueryParameters to specify what should be deleted on the device's data.
Success message indicating amount of records deleted (can be 0).
await Resources.devices.deleteDeviceData("myDeviceId", { ids: ["recordIdToDelete", "anotherRecordIdToDelete" ] });
Modify any property of the device
Device ID
Device object with fields to replace
Edit data records in a 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.
Success message indicating amount of records updated (can be 0).
await Resources.devices.editDeviceData("myDeviceId", { id: "idOfTheRecord", value: "new value", unit: "new unit" });
Experimental
Get Info of the Device Chunks.
Device ID
Get data from all variables in the device.
Device ID.
Optional
queryParams: DataQueryQuery parameters to filter the results.
Array with the data values stored in the device.
const lastTenValues = await Resources.devices.getDeviceData("myDeviceId", { qty: 10 });
Experimental
Get Data Streaming
Device ID
Optional
params: DataQueryStreamingData Query
Optional
options: OptionsStreamingStream options
for await (const items of Resources.devices.getDeviceDataStreaming("myDeviceId")) {
console.log(items);
}
Get Info of the Device
Device ID
Retrieves a list with all devices from the account
Optional
queryObj: TSearch query params
queryObj: {
page: 1,
fields: ["id", "name"],
filter: {},
amount: 20,
orderBy: "name,asc",
resolveBucketName: false
resolveConnectorName: false
}
Experimental
Get a Streaming list of Devices from the account
Optional
queryObj: Omit<DeviceQuery, "page" | "amount">Search query params
Optional
options: OptionsStreamingStream options
for await (const items of Resources.devices.listStreaming({ name: "*sensor*" })) {
console.log(items);
}
List Params for the Device
Device ID
Optional
sentStatus: BooleanTrue return only sent=true, False return only sent=false
Create or edit param for the Device
Device ID
Configuration Data
Optional
paramID: stringParameter ID
Send data to device
Device ID.
An array or one object with data to be send to TagoIO
amount of data added
const result = await Resources.devices.sendDeviceData("myDeviceId", {
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
Device ID.
An array or one object with data to be send to TagoIO using device token
Optional
options: Omit<OptionsStreaming, "neverStop">Stream options
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 Resources.devices.sendDeviceDataStreaming("myDeviceId", data, {
poolingRecordQty: 1000,
poolingTime: 1000,
});
Generates and retrieves a new token
Device ID
Params for new token
Retrieves a list of all tokens
Device ID
Optional
queryObj: TSearch query params
queryObj: {
page: 1,
fields: ["name", "token", "permission"],
filter: {},
amount: 20,
orderBy: "created_at,desc",
}
Get amount of data stored in the Device.