Closed trevor229 closed 1 year ago
The data is available for about a year back. I can give you some example code if you want. Look at https://github.com/lrosenman/ambient for my Go helper library. I have some code I use to pull historical data to my database (currently being rewritten for some new fields).
I would appreciate the example code very much. I don't know what I am missing here.
I think my issue is the same issue. I am writing an app where I need to download all available historical data for the past year, but the only way I have found thus far is going through a series of steps on their website as a user. I don't want to sound cynical, but generally speaking it seems that Ambient Weather is trying to keep people from using the API. For example, I stumbled across these two URLs for downloading a JSON of my current and last 2 days of weather information: https://api.ambientweather.net/v1/devices?applicationKey={applicationKey}&apiKey={apiKey} https://api.ambientweather.net/v1/devices/{macAddress}?applicationKey={applicationKey}&apiKey={apiKey} While I have found these URLs to work beautifully, I am dumbfounded why they don't appear in ANY of the API's documentation. I am looking for a similar set of URLs for accessing the historical data for my weather station and, if possible, data summaries and sunrise/sunset/moonrise/moonset/moon phase information for my location. Any help in getting this information will be most appreciated.
Addendum. I would also be interested in a URL that allows me to download a weather forecast for my location as well.
@CrawfordRD this should give you what you need to download your device's historical data: https://ambientweather.docs.apiary.io/#reference/0/device-data/query-device-data. Use can use the endDate
parameter to query for older data.
unfortunately, the ambient API does not return summaries or sun/moon data. I've found this library useful for the latter https://github.com/darkskyapp/astro
I just discovered the method that @CrawfordRD was discussing here. This seems to be the function that I am looking for myself, and I wish there was an API call that can allow for easy downloading of this csv at regular intervals. Once could then store the dates of retrieved data and merge the files locally for a continuous archive of their data. I'd really want to avoid doing the process manually (both downloading and merging) or relying on my display's data that could vanish with an extended power outage if not regularly backed up to an SD card.
Thank you @owise1 for your response. I tried the URL you sent me and it worked with mixed results. Specifically, most of the data points returned looked like this:
{"dateutc":1669457100000,"tempinf":68.5,"humidityin":42,"baromrelin":30.151,"baromabsin":28.671,"tempf":34.9,"battout":1,"humidity":98,"winddir":288,"windspeedmph":0.9,"windgustmph":1.1,"maxdailygust":1.1,"hourlyrainin":0,"eventrainin":0.051,"dailyrainin":0,"weeklyrainin":0.051,"monthlyrainin":0.051,"totalrainin":0.051,"solarradiation":0,"uv":0,"batt_co2":1,"feelsLike":34.9,"dewPoint":34.39,"feelsLikein":67,"dewPointin":44.5,"lastRain":"2022-11-25T14:37:00.000Z","date":"2022-11-26T10:05:00.000Z"}
but then there would be block of data points, some representing over an hour of data points, that were missing most of the outside weather data. They looked like this:
{"dateutc":1669456200000,"tempinf":68.7,"humidityin":42,"baromrelin":30.145,"baromabsin":28.666,"battout":1,"batt_co2":1,"feelsLikein":67.2,"dewPointin":44.7,"lastRain":"2022-11-25T14:37:00.000Z","date":"2022-11-26T09:50:00.000Z"}
Usually the data points with the missing keys were towards the bottom of the JSON file.
I looked at the Astro module you suggested but could not find any documentation to tell me what methods it offered. I have found that the U.S. Naval Observatory has an API that can give daily sunrise/sunset/moonrise/moonset/moonphase, annual major-moon-phase/start-of-season/Daylight-Savings-Time/solar eclipses via requests. If you are interested then it can be found at https://aa.usno.navy.mil/data/api. (FYI, I tried it this morning and the moonset value was missing; turns out that the moon rises today at 1:20 pm and does not set until 12:04 am tomorrow, so there is no moonset today - the data was correct).
Again, thank you for your help.
Also, I am watching to see if anyone can help @trevor229 find a means of downloading csv versions of the data using a CLI.
Hi, apologies if this isn't the pace I should ask but I don't know where else to ask.
I am aware of the current API features and I am also aware that I can locally save data from my WS2000 station via SD card. I am wondering if there is any other way either using the API or a separate page on the Ambient Weather site that will allow me to download or query for historical/archived weather data? Obviously it is being archived to some database because you can see it all on the charts and graphs page, but I was wondering how difficult that would be able to implement into the current API if possible.