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 One Call API #16

Closed
ebaauw opened this issue Apr 27, 2020 · 6 comments
Closed

OpenWeatherMap One Call API #16

ebaauw opened this issue Apr 27, 2020 · 6 comments
Labels
enhancement New feature or request

Comments

@ebaauw
Copy link
Owner

ebaauw commented Apr 27, 2020

OpenWeatherMap have introduced a new, richer API, see https://openweathermap.org/api/one-call-api. It might be opportune for Homebridge WS to be using that:

  • Looks like they do include rain1h in the One Call API. I dropped that from Homebridge WS after moving from Wunderground to OpenWeatherMap. There might be a snow1h as well. No evidence of rain24h though;
  • Not sure how to expose the forecasts. Adding more services to the existing accessory will confuse Eve, breaking the history. Probably would need to introduce a new accessory per forecast. But adding 60 accessories (48 hours, 7 days, 5 previous days) seems to bit overdone. Would appreciate any input on that;
  • Looks like the One Call API only accepts coordinates, not locations. Would need to change config.json, or make a Current Weather API call to map location to coordinates, see also ability to use coordinates instead of city name #13.
@ebaauw ebaauw added enhancement New feature or request help wanted Extra attention is needed labels Apr 27, 2020
@oly13
Copy link

oly13 commented Apr 27, 2020

Thats my thoughts,
· To expose the forecast create 3 accesories: Current, 1h, 24h.
· For coordinates, keep the location input, but transform it to coordinates for the api call if there is a free tier to achieve that.

@SebSemmi
Copy link

SebSemmi commented May 3, 2020

an accessory group for rain and snow. Each group as 3 contact sensor tiles for current, 1h, 24h. So you should be able to setup a notification.

ebaauw added a commit that referenced this issue May 3, 2020
Add support for OpenWeatherMap `onecall` API, see #16.
ebaauw added a commit that referenced this issue May 3, 2020
Add support for OpenWeatherMap `onecall` API, see #16.
Persist `lon` and `lat`, so `weather` API only needs to be called for new locations, to lookup the coordinates.
ebaauw added a commit that referenced this issue May 3, 2020
- Use observation from `onecall` API instead of `weather` API, see #16;
- Re-introduce _Rain Last Hour_, _Total Rain_, and _UV Index_ characteristics.
@ebaauw
Copy link
Owner Author

ebaauw commented May 3, 2020

Looks like they do include rain1h in the One Call API. I dropped that from Homebridge WS after moving from Wunderground to OpenWeatherMap. There might be a snow1h as well. No evidence of rain24h though;

The daily forecasts include (I assume: total) rain. Re-introduced Rain Last Hour, Total Rain, and UV Index characteristics. I don't know if there's similar characteristics for snow, currently still ignoring it.

For coordinates, keep the location input, but transform it to coordinates for the api call if there is a free tier to achieve that.

Done. That actually turned out to be easier than I anticipated.

To expose the forecast create 3 accesories: Current, 1h, 24h.

Each group as 3 contact sensor tiles for current, 1h, 24h. So you should be able to setup a notification.

I fear Eve might choke on a single accessory with three contact sensor services, so I might need to go for three accessories. That also leaves the possibility to add Eve history.

HomeKit provides notifications for a number of sensors: Contact, Lock, Motion, Smoke, Leak, and probably more that I don't have. I would think Leak makes most sense semantically? However, I don't think they've yet reversed engineered the history for the Eve WaterGuard (assuming it even has one).

ebaauw added a commit that referenced this issue May 8, 2020
- Additional leak sensor per accessory, see #16.
- Optional second accessory with leak sensor per (daily/hourly) forecast, see #16.
ebaauw added a commit that referenced this issue May 8, 2020
Add Leak Sensor services for current report, and for daily and hourly forecasts, see #16.
@ebaauw
Copy link
Owner Author

ebaauw commented May 8, 2020

OK, added dailyForecasts and hourlyForcecasts config.json parameters to expose forecasts. They're exposed under a separate Forecasts accessory, with a single service per forecast. With 47 hourly and 7 daily forecasts, there's no room for multiple services per forecast, without running the risk of hitting the 99 services per accessory limit. And I don't want to expose additional accessories, to prevent hitting the 149 accessories per bridge limit.

I now expose an additional Leak Sensor service on the main accessory (and moved the full weather report over there, from the Air Pressure sensor). Leak Detected is set on rain or snow. You should be able to get HomeKit notifications for this. The Forecast services are also exposed as Leak Sensors.

@ebaauw ebaauw removed the help wanted Extra attention is needed label May 8, 2020
@oly13
Copy link

oly13 commented May 8, 2020

Thats great

@ebaauw
Copy link
Owner Author

ebaauw commented May 8, 2020

Please have a look at v2.3.0.

@ebaauw ebaauw closed this as completed May 10, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants