Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Openweathermap input uses 3h rain value instead of 1h #6583

Closed
lhanson opened this issue Oct 27, 2019 · 2 comments · Fixed by #6593
Closed

Openweathermap input uses 3h rain value instead of 1h #6583

lhanson opened this issue Oct 27, 2019 · 2 comments · Fixed by #6593
Labels
feature request Requests for new plugin and for new features to existing plugins
Milestone

Comments

@lhanson
Copy link
Contributor

lhanson commented Oct 27, 2019

Relevant telegraf.conf:

[[inputs.openweathermap]]
  app_id = "my openweathermap API token"
  city_id = "[5261457]"
  fetch = ["weather"]
  units = "imperial"
  interval = "10m"

System info:

Telegraf 1.12.4
Raspbian Linux, kenrel 4.19.66

Steps to reproduce:

It's raining at my location right now. Temperature, humidity, and other values are refreshed every 10m by the plugin. The sample plugin configuration says that API data is updated every 10 minutes, though the openweathermap site merely indicates "<2 hours".

A call to the API shows this:

$ curl --silent "http://api.openweathermap.org/data/2.5/weather?id=5261457&units=imperial&appid=$OPENWEATHERMAP_TOKEN" | jq '.rain' 
{
  "1h": 0.91
}

Because the plugin references the 3h value which isn't present at the moment in the API, my graphs do not show that it is currently raining.

Expected behavior:

I'd like my data points to reflect current rain values as much as possible.

Actual behavior:

Current rain values aren't shown as the API isn't returning a "3h" average.

@lhanson
Copy link
Contributor Author

lhanson commented Oct 27, 2019

And now that it's been >3h since I last checked in, the openweathermap API is still only showing 1h, so it apparently has nothing to do with actual rain values. Nothing on the openweathermap site is indicative of why that might be (though the fact that I'm not currently giving them money might be a factor).

If the upstream source doesn't seem to be providing the 3h values, I suggest the plugin switch to 1h. If this makes sense and it's a change which would be merged, I'd be happy to submit the PR myself.

@lhanson
Copy link
Contributor Author

lhanson commented Oct 29, 2019

This seems to be something of a known issue, though not predictable when calling the API, and the rain values in general seem to be a bit flaky judging from the OpenWeatherMap support forum. The plugin should probably be flexible enough to use 1h if present, otherwise fall back to 3h.

@sjwang90 sjwang90 added the feature request Requests for new plugin and for new features to existing plugins label Oct 29, 2019
lhanson added a commit to lhanson/telegraf that referenced this issue Oct 30, 2019
The OpenWeatherMap API doesn't reliably return "3h" rain values,
so we examine the response for "1h" (preferred) or "3h" values as it
seems to depend on the particular weather station used which value will
be returned (see
https://openweathermap.desk.com/customer/en/portal/questions/17663899-rain-1h-3h-are-mutually-exclusive-?new=17663899).

Closes influxdata#6583
lhanson added a commit to lhanson/telegraf that referenced this issue Oct 30, 2019
The OpenWeatherMap API doesn't reliably return "3h" rain values,
so we examine the response for "1h" (preferred) or "3h" values as it
seems to depend on the particular weather station used which value will
be returned (see
https://openweathermap.desk.com/customer/en/portal/questions/17663899-rain-1h-3h-are-mutually-exclusive-?new=17663899).

Closes influxdata#6583
lhanson added a commit to lhanson/telegraf that referenced this issue Oct 30, 2019
The OpenWeatherMap API doesn't reliably return "3h" rain values,
so we examine the response for "1h" (preferred) or "3h" values as it
seems to depend on the particular weather station used which value will
be returned (see
https://openweathermap.desk.com/customer/en/portal/questions/17663899-rain-1h-3h-are-mutually-exclusive-?new=17663899).

Closes influxdata#6583
lhanson added a commit to lhanson/telegraf that referenced this issue Oct 30, 2019
The OpenWeatherMap API doesn't reliably return "3h" rain values,
so we examine the response for "1h" (preferred) or "3h" values as it
seems to depend on the particular weather station used which value will
be returned (see
https://openweathermap.desk.com/customer/en/portal/questions/17663899-rain-1h-3h-are-mutually-exclusive-?new=17663899).

Closes influxdata#6583
@danielnelson danielnelson modified the milestones: 1.12.5, 1.13.0 Nov 8, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request Requests for new plugin and for new features to existing plugins
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants