Device¶
In order to modify, add, delete or do anything else with the data inside buckets, it is necessary to use the device function.
Instance¶
Parameters:
token: strDevice TokenOptional region: Regions: “usa-1” or “env”Region is a optional parameter
from tagoio_sdk import Device
myDevice = Device({"token": "my_device_token", "region": "usa-1"})
info¶
Get information about the current device.
from tagoio_sdk import Device
myDevice = Device({ "token": "my_device_token" })
result = myDevice.info()
sendData¶
Send data to device.
from tagoio_sdk import Device
myDevice = Device({ "token": "my_device_token" })
result = myDevice.sendData({
"variable": "temperature",
"unit": "F",
"value": 55,
"time": "2015-11-03 13:44:33",
"location": { "lat": 42.2974279, "lng": -85.628292 },
})
getData¶
Get data from TagoIO Device.
Parameters:
queryParams: DataQueryObject with query params
from tagoio_sdk import Device
myDevice = Device({ "token": "my_device_token" })
result = myDevice.getData({
"query": "last_item",
"variable": "humidity",
})
editData¶
Edit data in a Mutable-type device.
from tagoio_sdk import Device
myDevice = Device({"token": "my_device_token"})
result = myDevice.editData(
{
"id": "id_of_the_data_item",
"value": "123",
"time": "2022-04-01 12:34:56",
"location": {"lat": 42.2974279, "lng": -85.628292},
}
)
deleteData¶
Delete data from device.
Parameters:
queryParams: DataQueryObject with query paramsIf not pass any query param, it will delete the last item
from tagoio_sdk import Device
myDevice = Device({ "token": "my_device_token" });
result = myDevice.deleteData({
"query": "last_item",
"variable": "humidity",
"value": 10
});
getParameters¶
Get parameters from device.
Parameters:
onlyUnRead: boolset true to get only unread parameters
from tagoio_sdk import Device
myDevice = Device({ "token": "my_device_token" })
result = myDevice.getParameters()
setParameterAsRead¶
Mark parameter as read.
Parameters:
parameterID: GenericID: strParameter identification
from tagoio_sdk import Device
myDevice = Device({ "token": "my_device_token" })
result = myDevice.setParameterAsRead(parameterID="parameter_id")