R wrapper for Danfoss Ally API
Install the development version from github:
## install.packages("devtools")
devtools::install_github("itkonen/rally")
Once installed, follow the setup guide at https://developer.danfoss.com/ to get your API key and secret. The API uses an OAuth 2.0 client credentials grant to give access to your data.
Authorize your app with your API key and secret:
library(rally)
set_credentials("my_key", "my_secret")
Alternatively, you can use the environmental variables RALLY_KEY
and
RALLY_SECRET
.
To get one or all devices and their status, use get_devices
get_devices()
get_devices(id = "abcd1234")
For convenience, you can use devices()
to get a single tibble
containing both device and status information.
Set device status with set_device
, e.g.:
set_device(id = "abcd1234", code = "temp_set", "200")
or use the shorthand wrapper:
temp_set(id = "abcd1234", 20.0)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.