dimfalk / netatmo.weather Goto Github PK
View Code? Open in Web Editor NEWR wrapper for Netatmo Weather API
License: GNU General Public License v3.0
R wrapper for Netatmo Weather API
License: GNU General Public License v3.0
Error in character(n_stations) : invalid 'length' argument
dim(r_json$body)[1]
NULL
do the objects even share a common index? seems like they do: all time series ending on 2022-05-10 21:09:56
.
pro:
neutral:
xts[, 99]
colSums(xts)
cons:
plot(zoo::index(xts), zoo::coredata(xts)
fails due to differening lengths between x
and y
--> / dim(xts)[2]
?xts
attribute assignmentrstack2xts::create_xtslist()
microbenchmark
: list(xts)
wins.<sf> %>% dplyr::group_by_all() %>% dplyr::distinct(GN) %>% class() != "sf" "data.frame"
instead: "sf" "grouped_df" "tbl_df" "tbl" "data.frame"
<sf> %>% unique() %>% class() == "sf" "data.frame"
works generally but omits duplicates because of deviations in time_server
making rows not completely identical
# optional progress bar:
if(progbar) lapply <- pbapply::pblapply
svMisc::progress()
pb = txtProgressBar(min = 0, max = length(ind), initial = 0)
setTxtProgressBar(pb,i)
close(pb)
progress::progress_bar()
osm_plz_simplified |> dplyr::filter(plz == "45145")
#> Simple feature collection with 1 feature and 1 field (with 1 geometry empty)
#> Geometry type: GEOMETRYCOLLECTION
#> Dimension: XY
#> Bounding box: xmin: NA ymin: NA xmax: NA ymax: NA
#> Geodetic CRS: WGS 84
#> plz geometry
#> 1 45145 GEOMETRYCOLLECTION EMPTY
resp$status_code
== 403
$error
$error$code
[1] 3
$error$message
[1] "Access token expired"
does this undocumented option also apply to other parameters?
e.g.
p1 <- get_period()
get_measure(device = "70:ee:50:6b:34:74", period = p1, par = "pressure")
https://github.com/r-lib/httr2
Major differences:
https://httr2.r-lib.org/articles/wrapping-apis.html#secret-management
if queried e.g. type = "min_temp"
and type = "max_temp"
, are these absolute min. and max. values or just min. and max. means, which can be replicated easily via xts::period.apply()
using values of highest resolution with resolution = 5min
?
to put it in other words: is this idea of a statement
variable even meaningful?
e.g. rrapply(content(out)$properties$data, how = "bind")
or jsonlite::fromJSON(x, flatten = TRUE)
?
& make use of {progress}
loop over seq
and perform sf::st_intersection(stations, gem) %>% dim() %>% head(1)
stations <- get_public_data(bbox = "Essen", use_tiles = FALSE)
xxx <- get_measure(stations, parameter = "rain", resolution = 5, from = "2022-04-04", to = "2022-04-06")
via sf::st_bbox()
?
decrypt token to /netatmo.weather/
, not to /netatmo.weather/tests/testthat/
.
as an alternative, also look for token in /tests/testthat/
?
compare
get_measure(stations, parameter = "rain", resolution = "5min") %>% xts::period.apply(., endpoints_daily, sum)
with
get_measure(stations, parameter = "rain", resolution = "1day")
match.arg()
?
https://api.netatmo.com/api/getpublicdata?lat_ne=51.534212512933&lon_ne=7.13765569051402&lat_sw=51.3475823924406&lon_sw=6.89433840876147&required_data=temperature&filter=false --> single element:
{
"_id": "70:ee:50:04:ce:cc",
"place": {
"location": [
7.03422676517418,
51.44927292647
],
"timezone": "Europe/Berlin",
"country": "DE",
"altitude": 114,
"city": "Essen",
"street": "Steeler Straße"
},
"mark": 1,
"measures": {
"02:00:00:34:01:d2": {
"res": {
"1649874836": [
19.3,
61
]
},
"type": [
"temperature",
"humidity"
]
},
"70:ee:50:04:ce:cc": {
"res": {
"1649874841": [
1016.3
]
},
"type": [
"pressure"
]
},
"05:00:00:00:bc:26": {
"rain_60min": 0,
"rain_24h": 0,
"rain_live": 0,
"rain_timeutc": 1649874830
},
"06:00:00:01:ca:5e": {
"wind_strength": 1,
"wind_angle": -1,
"gust_strength": 2,
"gust_angle": -1,
"wind_timeutc": 1649874836
}
},
"modules": [
"02:00:00:34:01:d2",
"05:00:00:00:bc:26",
"06:00:00:01:ca:5e"
],
"module_types": {
"02:00:00:34:01:d2": "NAModule1",
"05:00:00:00:bc:26": "NAModule3",
"06:00:00:01:ca:5e": "NAModule2"
}
}
attribute variables are assumed to be spatially constant throughout all geometries.
using match.arg()
?
period = _
"recent"
: last 24 hoursc(from, to)
is.null()
defaults to e.g. max. allowed n"date_min_pressure"
"date_max_pressure"
"date_min_temp"
"date_max_temp"
"date_min_hum"
"date_max_hum"
"date_min_gust"
"date_max_gust"
mean | min_ | max_ | date_min_* | date_max_* | |
---|---|---|---|---|---|
temperature | min_temp | max_temp | date_min_temp (***) | date_max_temp (***) | |
humidity | min_hum | max_hum | date_min_hum (***) | date_max_hum (***) | |
co2 (*) | min_co2 (*) | max_co2 (*) | date_min_co2 (***) | date_max_co2 (***) | |
pressure | min_pressure | max_pressure | date_min_pressure (***) | date_max_pressure (***) | |
noise (*) | min_noise (*) | max_noise (*) | date_min_noise (***) | date_max_noise (***) | |
rain (**) | min_rain (**) | max_rain (**) | sum_rain | date_min_rain (***) | date_max_rain (***) |
windstrength | windangle | guststrength | gustangle | date_min_gust (***) | date_max_gust (***) |
(*): Does not seem to be available to the public via /getmeasure since this is essentially private indoor data?
(**): Precipitation values except from "sum_rain" seem to be useless - what's the point of min/mean/max of individual data samples, when you're interested in the integral over time? - especially at higher resolutions. Intentionally ignored to prevent confusion, c.f. #25.
(***): All these timestamps can be derived from the original xts objects and are therefore ignored for now, c.f. #33.
actual modification takes place in gpd_json2sf()
now accepting a meas = TRUE
argument.
As of today, when you refresh an Access Token using the associated endpoint https://api.netatmo.com/oauth2/token, Netatmo servers respond with a couple of tokens : an Access Token and a Refresh Token.
If the previous Access Token is still valid, the newly returned access token is identical but its expiration time is extended for 3 hours.
In any case, the refresh token is not renewed.
Starting from the 17/04/2023, this behavior will change to to be compliant with the recommendations of the RFC of the OAuth2 Authorization Framework (section 10.4) and improving the security of the data of our users.
When refreshing tokens, Access Token and Refresh Token will be automatically renewed and former tokens invalidated.
What does it means for me ?
If you were already updating the tokens provided when refreshing your tokens, this change will not impact you.
If you do not update the refresh token when refreshing your Access Token, your users will be disconnected after 3 hours as the former tokens will become invalidated.
To fix it, you need to update the tokens as soon as you get the newly generated ones.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.