{"id":13834444,"url":"https://github.com/DDorch/Rthingsboard","last_synced_at":"2025-07-10T04:31:58.368Z","repository":{"id":56934236,"uuid":"316160009","full_name":"DDorch/Rthingsboard","owner":"DDorch","description":"R package for interacting with the API of ThingsBoard open-source IoT platform.","archived":false,"fork":false,"pushed_at":"2022-01-21T10:54:01.000Z","size":262,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-06-09T06:13:21.363Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"R","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"agpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/DDorch.png","metadata":{"files":{"readme":"README.Rmd","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-11-26T07:56:37.000Z","updated_at":"2024-06-10T09:31:51.000Z","dependencies_parsed_at":"2022-08-21T05:20:44.572Z","dependency_job_id":null,"html_url":"https://github.com/DDorch/Rthingsboard","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/DDorch/Rthingsboard","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DDorch%2FRthingsboard","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DDorch%2FRthingsboard/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DDorch%2FRthingsboard/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DDorch%2FRthingsboard/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/DDorch","download_url":"https://codeload.github.com/DDorch/Rthingsboard/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DDorch%2FRthingsboard/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264528742,"owners_count":23623219,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-04T14:00:34.719Z","updated_at":"2025-07-10T04:31:58.094Z","avatar_url":"https://github.com/DDorch.png","language":"R","readme":"---\r\noutput: github_document\r\n---\r\n\r\n\u003c!-- README.md is generated from README.Rmd. Please edit that file --\u003e\r\n\r\n```{r, include = FALSE}\r\nknitr::opts_chunk$set(\r\n  collapse = TRUE,\r\n  comment = \"#\u003e\",\r\n  fig.path = \"man/figures/README-\",\r\n  out.width = \"100%\"\r\n)\r\n```\r\n\r\n```{r echo=FALSE, results=\"hide\", message=FALSE}\r\nlibrary(\"badger\")\r\n```\r\n\r\n# Rthingsboard\r\n\r\n\u003c!-- badges: start --\u003e\r\n`r badge_license(color = \"orange\")`\r\n`r badge_lifecycle(\"maturing\", color = \"blue\")`\r\n`r badge_devel(color = \"blue\")`\r\n[![R build status](https://github.com/DDorch/Rthingsboard/workflows/R-CMD-check/badge.svg)](https://github.com/DDorch/Rthingsboard/actions)\r\n`r badge_code_size(\"DDorch/Rthingsboard\")`\r\n\u003c!-- badges: end --\u003e\r\n\r\nThe goal of 'Rthingsboard' is to provide interaction with the API of 'ThingsBoard' (https://thingsboard.io/), an open-source IoT platform for device management, data collection, processing and visualization.\r\n\r\n\r\n\r\n## Installation\r\n\r\nYou can install the released version of 'Rthingsboard' from [CRAN](https://CRAN.R-project.org/package=Rthingsboard) with:\r\n\r\n``` r\r\ninstall.packages(\"Rthingsboard\")\r\n```\r\n\r\nAnd the development version from [GitHub](https://github.com/) with:\r\n\r\n``` r\r\n# install.packages(\"devtools\")\r\ndevtools::install_github(\"DDorch/Rthingsboard\")\r\n```\r\n## Example\r\n\r\nThis is a basic example which shows you how to extract data from the following public dashboard : http://scada.g-eau.fr/dashboard/4db16100-f3e9-11e8-9dbf-cbc1e37c11e3?publicId=299cedc0-f3e9-11e8-9dbf-cbc1e37c11e3\r\n\r\n### Load library\r\n\r\n```{r setup}\r\nlibrary(Rthingsboard)\r\n```\r\n\r\n### Define the configuration parameters\r\n\r\n```{r parameters}\r\n# Identifier of SupAgro Halle hydraulique SCADA\r\nurl = \"http://scada.g-eau.fr\"\r\npublicId = \"299cedc0-f3e9-11e8-9dbf-cbc1e37c11e3\"\r\nentityId = \"18d56d50-f3e9-11e8-9dbf-cbc1e37c11e3\"\r\nstartDate = as.POSIXct(\"2020-11-19 15:00:00\", tz = \"Europe/Paris\")\r\nendDate = as.POSIXct(\"2020-11-19 18:00:00\", tz = \"Europe/Paris\")\r\n\r\n# Set logger threshold to DEBUG to see extra messages for debug purpose\r\nlogger::log_threshold(logger::DEBUG)\r\n```\r\n\r\n### Connexion to the 'ThingsBoard' server\r\n\r\nFirst, you need to create an object of class `ThingsboardApi` as follow:\r\n\r\n``` {r connection}\r\n# Connection to the API\r\ntb_api = ThingsboardApi(url = url, publicId = publicId)\r\n```\r\n### Retrieve data from the 'ThingsBoard' server\r\n\r\nYou can get the available keys on the specified device defined by its `entityId`:\r\n\r\n``` {r getKeys}\r\n# Get list of keys\r\nkeys = tb_api$getKeys(entityId = entityId)\r\n```\r\n\r\nKnowing the name of the available keys, you can get the telemetry of this device for a given period defined by `startTS` and `endTS`.\r\n\r\nHere below, we download the telemetry for all keys beginning by \"Y\":\r\n\r\n```{r getTelemetry}\r\ndf \u003c- tb_api$getTelemetry(entityId,\r\n                       keys = keys[grep(\"^Y\", keys)],\r\n                       startTs = startDate,\r\n                       endTs = endDate)\r\n```\r\n\r\nHere below the first records of the extracted telemetry:\r\n\r\n```{r time zone}\r\nknitr::kable(head(df))\r\n```\r\n\r\nYou can then record this table into a file in the current directory:\r\n\r\n```{r write_csv, eval=FALSE}\r\n# getwd() # to get the path of the current directory\r\nwrite.csv2(df, \"myData.csv\")\r\n```\r\n\r\nAnd also plot some time series:\r\n\r\n```{r plot_telemetry}\r\nlibrary(ggplot2)\r\nggplot(df, aes(x = ts, y = value)) +\r\n  geom_line(aes(color = key), size = 1) +\r\n  scale_color_brewer(palette = \"Set1\")\r\n```\r\n\r\n","funding_links":[],"categories":["SDKs and REST clients"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FDDorch%2FRthingsboard","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FDDorch%2FRthingsboard","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FDDorch%2FRthingsboard/lists"}