Optional
queryParams: DataQueryconst 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.
Success message with the amount of data items updated.
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 },
});
Get data from TagoIO Device.
Optional
queryParams: DataQuerySummaryObject with query params
An array of TagoIO registers
const myDevice = new Device({ token: "my_device_token" });
const result = await myDevice.getData({
query: "last_item",
variable: "humidity",
});
Optional
queryParams: DataQueryAggregateOptional
queryParams: DataQueryDefaultOptional
queryParams: DataQueryFirstLastExperimental
Get Data Streaming
Optional
params: DataQueryStreamingData Query
Optional
options: OptionsStreamingStream options
const myDevice = new Device({ token: "my_device_token" });
for await (const items of myDevice.getDataStreaming()) {
console.log(items);
}
Get paronlyUnReameters from device
const myDevice = new Device({ token: "my_device_token" });
const result = await myDevice.getParameters();
Get information about the current device
const myDevice = new Device({ token: "my_device_token" });
const result = await myDevice.info();
Send data to device
An array or one object with data to be send to TagoIO using device token
amount of data added
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
An array or one object with data to be send to TagoIO using device token
Stream options
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,
});
Delete data from device