This repository was archived by the owner on Mar 16, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathREADME.Rmd
96 lines (66 loc) · 2.41 KB
/
README.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
---
output: github_document
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
```
# rzentra
<!-- badges: start -->
[](https://www.tidyverse.org/lifecycle/#deprecated)
[](https://CRAN.R-project.org/package=rzentra)
[](https://github.com/basf/rzentra/actions)
[](https://codecov.io/gh/basf/rzentra)
<!-- badges: end -->
An R client for [Zentracloud API](https://zentracloud.com/api/v1/guide#APIGuidelines).
**DEPRECATED:** Please use the official client package: https://gitlab.com/meter-group-inc/pubpackages/zentracloud
## Installation
## Example
```{r load}
library("rzentra")
```
### Authentcation
To work with the API you first need to authenticate.
The `zc_token()` function authenticates you with your username and password and returns a `token` that can be used in subsequent API-calls.
The `username` & `password` are by default read from environmental variables
`ZC_USERNAME` and `ZC_PASSWORD`, but you can provide them also in every function call
using the `username=` and `password=` arguments.
```{r token, eval=FALSE}
token <- zc_token(username = "yourname", password = "yourpassword")$token
```
### Querying data
#### Device settings
Querying the settings of a device can be done with `zc_settings`
```{r settings, eval=FALSE}
zc_settings(token = token,
sn = "z6-00033",
start_time = as.numeric(as.POSIXct(Sys.Date(), origin = "1970-01-01"))
)
```
#### Device statuses
Querying the settings of a device can be done with `zc_statuses`
```{r status, eval=FALSE}
zc_statuses(token = token,
sn = "z6-00033",
start_time = as.numeric(as.POSIXct(Sys.Date(), origin = "1970-01-01"))
)
```
#### Device readings
```{r readings, eval=FALSE}
zc_readings(token = token,
sn = "z6-00033",
start_time = as.numeric(as.POSIXct(Sys.Date(), origin = "1970-01-01"))
)
```
### Parsing data
Readings can be parsed into a long time-series table with `zc_timeseries()`
```{r parse, eval=FALSE}
head(
zc_timeseries(readings)
)
```