things {Rduinoiot}R Documentation

Things API methods

Description

Create, Update, List, Show and Delete properties associated to a given thing

Official documentation:

Usage

things_create(
  device_id = NULL,
  thing_id = NULL,
  name = NULL,
  properties = NULL,
  timezone = NULL,
  force = FALSE,
  store_token = "option",
  token = NULL,
  silent = FALSE
)

things_update(
  device_id = NULL,
  thing_id = NULL,
  name = NULL,
  properties = NULL,
  timezone = NULL,
  force = FALSE,
  store_token = "option",
  token = NULL,
  silent = FALSE
)

things_list(
  device_id = NULL,
  thing_id = NULL,
  show_deleted = FALSE,
  show_properties = FALSE,
  tags = NULL,
  store_token = "option",
  token = NULL,
  silent = FALSE
)

things_show(
  thing_id,
  show_deleted = FALSE,
  store_token = "option",
  token = NULL,
  silent = FALSE
)

things_delete(
  thing_id,
  force = FALSE,
  store_token = "option",
  token = NULL,
  silent = FALSE
)

Arguments

device_id

The id of the device (The arn of the associated device)

thing_id

The id of the thing

name

The friendly name of the thing

properties

A tibble with the following columns (see things_properties_create)

  • name (required) The friendly name of the property

  • permission (required) The permission of the property (READ_ONLY or READ_WRITE allowed)

  • type (required) The type of the property (see details for exhaustive list of values)

  • update_strategy (required) The update strategy for the property value (ON_CHANGE or TIMED allowed)

  • max_value (optional, numeric) Maximum value of this property

  • min_value (optional, numeric) Minimum value of this property

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

  • tag (optional, numeric) The integer id of the property

  • update_parameter (optional, 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

timezone

A time zone name. Check get_timezone for a list of valid names. (default: America/New_York)

force

(logical) If TRUE, detach device from the other thing, and attach to this thing. In case of deletion, if TRUE, hard delete the thing. Default to FALSE

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)

show_deleted

(logical) If TRUE, shows the soft deleted things. Default to FALSE

show_properties

(logical) If TRUE, returns things with their properties, and last values. Default to FALSE

tags

tags you may want to filter from the list

Value

A tibble showing information about chosen thing or list of thing for current user

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()

### create thing ###
things_create(name = "test")

### check things list ###
t_list = things_list(silent = TRUE)
thing_id = t_list %>% filter(name == "test") %>% pull(id)

things_show(thing_id = thing_id)

### update thing ###
properties = tibble(name = c("test1", "test2"),
permission = rep("READ_ONLY", 2), type = rep("FLOAT", 2),
update_strategy = rep("ON_CHANGE", 2), update_parameter = rep(10, 2))

things_update(thing_id = thing_id, name = "test_update", properties = properties)

### delete thing ###
things_delete(thing_id = thing_id)

## End(Not run)

[Package Rduinoiot version 0.1.0 Index]