Create, Update, List, Show and Delete properties associated to a given thing
Official documentation:
Usage
things_properties_create(
thing_id,
name,
permission,
type,
update_strategy,
...,
store_token = "option",
token = NULL,
silent = FALSE
)
things_properties_update(
thing_id,
property_id,
name,
permission,
type,
update_strategy,
...,
store_token = "option",
token = NULL,
silent = FALSE
)
things_properties_list(
thing_id,
show_deleted = FALSE,
store_token = "option",
token = NULL,
silent = FALSE
)
things_properties_show(
thing_id,
property_id,
store_token = "option",
token = NULL,
silent = FALSE
)
things_properties_delete(
thing_id,
property_id,
store_token = "option",
token = NULL,
silent = FALSE
)
Arguments
- thing_id
The id of the thing
- name
The friendly name of the property
- permission
The permission of the property (READ_ONLY or READ_WRITE allowed)
- type
The type of the property (see details for exhaustive list of values)
- update_strategy
The update strategy for the property value (ON_CHANGE or TIMED allowed)
- ...
Optional parameters for
things_properties_create
:max_value
(numeric) Maximum value of this propertymin_value
(numeric) Minimum value of this propertypersist
(logic) IfTRUE
, data will persist into a timeseries databasetag
(numeric) The integer id of the propertyupdate_parameter
(numeric) The update frequency in seconds, or the amount of the property has to change in order to trigger an updatevariable_name
(character) The sketch variable name of the property
- store_token
Where your token is stored. If
option
it will be retrieved from the .Rprofile (not cross-session and default), ifenvir
it will be retrieved from environmental variables list (cross-session)- token
A valid token created with
create_auth_token
or manually. It notNULL
it has higher priority thenstore_token
.- silent
Whether to hide or show API method success messages (default
FALSE
)- property_id
The id of the property
- show_deleted
If
TRUE
, shows the soft deleted properties. Default toFALSE
Examples
if (FALSE) {
library(dplyr)
Sys.setenv(ARDUINO_API_CLIENT_ID = 'INSERT CLIENT_ID HERE')
Sys.setenv(ARDUINO_API_CLIENT_SECRET = 'INSERT CLIENT_SECRET HERE')
create_auth_token()
thing_id = "b6822400-2f35-4d93-b3e7-be919bdc5eba"
### create property ###
things_properties_create(thing_id = thing_id,
name = "test", permission = "READ_ONLY", type = "FLOAT",
update_strategy = "ON_CHANGE", update_parameter = 10)
### check properties list ###
p_list = things_properties_list(thing_id = thing_id, show_deleted = FALSE)
property_id = p_list %>% filter(name == "test") %>% pull(id)
things_properties_show(thing_id = thing_id, property_id = property_id)
### update property ###
things_properties_update(thing_id = thing_id, property_id = property_id,
name = "test_update", permission = "READ_ONLY", type = "FLOAT",
update_strategy = "ON_CHANGE", update_parameter = 10)
### delete property ###
things_properties_delete(thing_id = thing_id, property_id = property_id)
}