Skip to contents

Displays data of pimoroni enviro from prometheus

Alt textAlt text

Examples of how to setup your own Pimoroni Enviro

Getting Started with Enviro Plus
Enviro Plus Python GitHub Repository

In order to create your own server you need to: 1. Install pimoroni drivers in pi
2. Deploy a prometheus server in pi
3. After you deploy the server use the url as an argument in prometheus_url (see bellow)

Installation Instructions

install R

installation instructions can be found here: https://cran.r-project.org/
## install RStudio IDE (optional but a good idea)
installation instructions can be found here: https://posit.co/downloads/

open RStudio and type in the console:

install.packages("devtools")
library(devtools)
install_github("sedzinfo/golemenviro")

Usage

library(golemenviro)

substitute the url from your prometheus server

pimoroni(prometheus_url=c("http://pip1.crabdance.com:1507/api/v1/query_range","http://pip1.crabdance.com:1505/api/v1/query_range"))

When a server cannot be reached, its gauges and charts say so instead of showing an error, and get_data() returns NULL with a message.

Screenshots

Alt textAlt text

Development

The package is a golem app:

File Contents
R/run_app.R pimoroni(), which starts the app
R/app_ui.R, R/app_server.R The navbar page and the server, which connect the modules
R/mod_current.R The Current tab: a gauge with the latest reading of each sensor
R/mod_timeseries.R The Time Series tab: a chart per sensor
R/fct_data.R get_data(), which downloads the readings from Prometheus
R/fct_plots.R plot_time_series() and plot_gauge()
inst/app/www/ The CSS, the full screen button of the charts and the favicon
tests/testthat/ Tests, which run offline on saved Prometheus answers

Run the tests with devtools::test(), and the full package check with devtools::check().

Deploying to shinyapps.io

app.R starts the app with the two servers above; change them there for your own. Run rsconnect::deployApp() from the package folder, or open app.R in RStudio and click Publish. .rscignore keeps the upload to the files the app needs.


StarsWatchersRepo SizeOpen IssuesForksLast CommitContributorsLicenseWorkflow StatusR-CMD-check