tetlabo / ambientweatheR

R client to provide programmatic access to an Ambient Weather user's weather station data

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ambientweatheR

ambientweatheR provides programmatic access to an Ambient Weather user's weather station data via REST API.

Ambient Weather API documentation available HERE.

Main functions:

  • list_user_devices: Lists user's available devices and each device's most recent data
  • fetch_device_data: Fetches data from a device for a given date, or for the last 24 hours

Installation

devtools::install_github("andrewflack/ambientweatheR")

Example

library(ambientweatheR)
library(tidyverse)
mac_address <- list_user_devices() %>% flatten() %>% pluck("macAddress")
df <- seq.Date(as.Date("2019-08-01"), as.Date("2019-08-04"), "day") %>% 
  map(as.character) %>% 
  map_df(~ fetch_device_data(mac_address, .x)$content)
df %>% 
  select(date_time, tempf, feelsLike, dewPoint) %>% 
  gather(key = "key", value = "value", -date_time) %>% 
  ggplot(aes(x = date_time, y = value, colour = key)) + 
  geom_point()

About

R client to provide programmatic access to an Ambient Weather user's weather station data

License:Other


Languages

Language:R 100.0%