things_properties {Rduinoiot}R Documentation

Properties (of things) API methods

Description

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 property

  • min_value (numeric) Minimum value of this property

  • persist (logic) If TRUE, data will persist into a timeseries database

  • tag (numeric) The integer id of the property

  • update_parameter (numeric) The update frequency in seconds, or the amount of the property has to change in order to trigger an update

  • variable_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), if envir it will be retrieved from environmental variables list (cross-session)

token

A valid token created with create_auth_token or manually. It not NULL it has higher priority then store_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 to FALSE

Value

A tibble showing information about chosen property or list of properties for given thing

Examples

## Not run: 
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)

## End(Not run)

[Package Rduinoiot version 0.1.0 Index]