Commit 285d5fba authored by Dorchies David's avatar Dorchies David
Browse files

doc: Update README.md with installation and running instructions

No related merge requests found
Showing with 47 additions and 1 deletion
+47 -1
# SGLdataGrabber
R package for grabbing data from Seine Grands Lacs web site (https://seinegrandslacs.fr/fr/quatre-lacs-reservoirs-au-coeur-dun-bassin) and store them on a Thingsboard IoT platform (https://thingsboard.io/).
\ No newline at end of file
R package for grabbing data from Seine Grands Lacs web site (https://seinegrandslacs.fr/fr/quatre-lacs-reservoirs-au-coeur-dun-bassin) and store them on a Thingsboard IoT platform (https://thingsboard.io/).
## Requirements
Windows or Linux OS with R version 3.5+ installed.
An instance of Thingsboard with a dedicated device for storing all the data.
## Installation on Linux
This procedure installs libraries in the folder `~/R_LIBS` of the current user.
```shell
cd ~
mkdir R_LIBS
echo "R_LIBS='$(pwd)/R_LIBS'" > .Renviron
Rscript -e "install_packages(c('roxygen2','httr','jsonlite','textutils','dplyr'), lib = 'R_LIBS')"
git clone https://gitlab.irstea.fr/in-wop/sgldatagrabber.git
cp .Renviron sgldatagrabber/
cd sgldatagrabber
Rscript -e "roxygen2::roxygenise()"
cd ..
R CMD build sgldatagrabber
Rscript -e "install_packages('SGLdataGrabber_0.1.0.tar.gz', lib = 'R_LIBS')"
```
## Run the script
Create a R script (let's call it `~/run_SGLdataGrabber.R`) with the following lines:
```R
library("SGLdataGrabber")
thingsboard_UploadTelemetry(
"http://[domain.tld]/api/v1/[my_token_device]/telemetry",
SGL_GrabAllVariables()$Data
)
```
With `[domain.tld]` the URL of your Thingsboard instance and `[my_token_device]` your own device token given by your Thingsboard platform.
And then run your script:
```shell
cd ~
R run_SGLdataGrabber.R
```
Be careful of having the `.Renviron` file containing at least `R_LIBS='~/R_LIBS'` in the folder where R is executed in order to use local R installed packages.
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment