ebaauw / homebridge-ws

Homebridege plugin for virtual weather station
Apache License 2.0
106 stars 4 forks source link

OpenWeatherMap One Call API #16

Closed ebaauw closed 4 years ago

ebaauw commented 4 years ago

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:

oly13 commented 4 years ago

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 commented 4 years ago

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 commented 4 years ago

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 commented 4 years ago

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.

oly13 commented 4 years ago

Thats great

ebaauw commented 4 years ago

Please have a look at v2.3.0.