naofireblade / homebridge-weather-plus

A comprehensive weather plugin for homebridge.
MIT License
318 stars 63 forks source link

DarkSky Interval Question #32

Closed RGSMA closed 6 years ago

RGSMA commented 6 years ago

Since the DarkSky API "allows up to 1,000 free calls per day" can the interval be set to 1.5 or does it need to be a single digit?

Thanks

naofireblade commented 6 years ago

The interval currently needs to be an integer (so 1.5 is not possible). This parameter was designed to increase the value if you want to save data volume.

When lowering the interval for dark sky please consider that I have to make about 200 additional api calls per day to calculate the accumulated rain per hour for today and the upcoming 7 days. I do this request every 60 minutes for all 8 days = 192 calls.

As a result you have about 800 api calls per day for the "normal" update. Lowering the interval to 2 should fit the 1000 calls perfectly.

In the end please keep in mind that dark sky provides the api service for free and every update is associated with some costs for them and we shouldn't make more calls then necessary :) .

RGSMA commented 6 years ago

If my math is correct, I figure it would cost me about $5 per month if I wanted to upgrade my API account and call every minute.

6024 +192 365 /12 /10000 =$4.97

Thanks for the info.

naofireblade commented 6 years ago

I think 1000 calls per day are free even if you exceed the limit. So you should be charged for about 1.97$ per month.