What aspect of my code makes your configuration validation freeze? Could you elaborate?
I began researching this several months ago and sadly it is now a non-trivial problem to solve, at least in the USA. My guess is at the root is the newest splitting of duties between the climatologists (National Centers for Environmental Information) and the meteorologists (National Weather Service). Current precipitation for the hour, 3 hours, and such are the purview of the Weather Service. Once they become a historical record, like even yesterday, they are in the purview of the NCEI (formerly NCDC). As a result, the 1 day, 2 day, and longer precipitation accumulation are no longer “officially” available from the NWS as part of their current weather and forecasts.
In the past I was able to call up the hourly observations for a few days prior or even longer in order to do my own accumulation calculation, but even that disappeared from the FTP sites I can find. I wrote to the NWS and asked for access to the observation data and they gave me a web page link that I am currently scraping to get the precipitation data. But that makes me uncomfortable because it is not part of any documented system or FTP or API.
That 3 day observation history can be found by:
-
Go to https://www.weather.gov/ and enter your location
-
Then click “3 Day History” in the More Information column of the current conditions box
-
The resulting web page will be 72 hours of observation data for your location. This is apparently updated several times a day.
At this point you must dive into writing a python script. The web table can be scraped because the link does not change once you have located the relevant one for your location. The 18 column table has 1 hr, 3 hr, and 6hr precipitation in the last 3 columns. Once you have the table in something like Pandas or NumPy dataframe you can query the rows that are the prior 24 hours and total them to get the precipitation. All in all, a big pain.
For my part I think it will be easier and more fun to solve my need by building an ESP8266 D1 mini with a high quality tipping bucket rain gauge connected to it. I can then use MQTT and InfluxDB to accumulate the data for use by Home Assistant.
Then my precipitation data will be free from the whims of the commercial people (grumbling at you Weather Underground), or changes in the government agencies.
Adding “-X” to Dark Sky list.
- platform: darksky
api_key: !secret DarkSkyAPI
forecast:
- -2
- -1
- 0
- 1
- 2
the above errors on validation
- platform: darksky
api_key: !secret DarkSkyAPI
forecast:
- "-2"
- "-1"
- 0
- 1
- 2
- 3
This makes validation freeze.
Ok so it looks so negative values are not supported I wasn’t able to test myself so it was a long shot in the dark.
Dark sky does support previous dates weather, they have called Time Machine, which can be used to look back at previous days. https://darksky.net/dev/docs#time-machine-request
So I believe you could use the HTTP get sensor to obtain the data you want and pass it into a template sensor. https://www.home-assistant.io/components/rest/
There is also Smartweather if you are lucky enough to have someone who has a weather station near you.
Look here for a custom component: GitHub - briis/smartweather: WeatherFlow Smart Weather Component for Home Assistant
(It’s not mine)
I know it’s only been a week but did you make any progress with this? I am considering something similar.
Sorry, no I haven’t had time to put the rain gauge together yet. However, I have been working on a bee hive monitor project on hack-a-day and the code is working for that.
In order to put a rain gauge on it there will only be a couple of lines of code to monitor the digital pin closures and add 0.01 inches (my gauge bucket size) to a pair of accumulators. One a daily total and one an hourly total. For the hive monitor I am updating the time via NTP once a day so my millis() function will give me semi-real time. On the rain gauge I expect I will send an MQTT message each hour with the total for that hour and then clear the accumulator for the next hour. Ditto for midnight.
Sending the hourly and daily totals may seem redundant, but it forms a simple error check.