Yet Another Weather Driver (but for Edge!)

I did some exploring and came up empty. I don’t see any way to use a Weather Channel API - it’s really set up for business use and not consumers. Their product pages are an exercise in frustration and futility…

2 Likes

yes, it’s a calculated value based on time of day and observed conditions. here’s the logic for how lux was calculated in the estimateLux function

1 Like

Drive Update! Version 2022-09-02T01:35:38.321971985

This update adds support for OpenWeather. Thanks to @K_White and @Alwas for recommending. I think it will be a decent replacement for when DarkSky stops working at the end of this month, as it is free and has good geographic coverage.

To use OpenWeather’s API’s all you need to do is register an account and you will be assigned an API key. (No credit card required). The API key will be required in your URL requests. Please note that the free access only supports the 2.5 API, not the 3.0 API.

The URLs to use for OpenWeather are as follows:

Current Conditions:

https://api.openweathermap.org/data/2.5/weather?lat=nn.nnnn&lon=nn.nnnn&appid=<yourAPIkey>

Forecast:

https://api.openweathermap.org/data/2.5/forecast?lat=nn.nnnn&lon=nn.nnnn&appid=<yourAPIkey>

One last thing to note regarding OpenWeather data: using the default units (‘standard’), the temperature is returned in degrees Kelvin. However, configure device Settings for received temperature as Celsius (the driver will do the conversion).

5 Likes

Hi @TAustin
I managed to get it working with open weather. But I can’t get my location because of the minus before the longitude.
https://api.openweathermap.org/data/2.5/weather?lat=x5.xxx7&lon=-73.xxxx&appid= x my API x

If I remove the minus I get weather but from somewhere else !!!

Thank you

Are you sure that is a minus character? I have one on mine (as would most in North and South America!) and don’t have a problem.

Have you tried typing your URL into a browser and making sure it works? If it works there, it should work in the driver as long as you have copy/pasted it exactly right.

Thanks. I just set up and it is working. I like Open Weather better than the US Gov. data as a source.

I can’t seem to get the Edge Weather installed on my hub. The driver is installed but isn’t found when I search nearby.
I have uninstalled and reinstalled the driver from the channel link as well as the CLI and still no luck. Any other suggestions?

Yes it seem to be more reliable too. I often get 5xx server errors from the US Gov site.

That’s very odd. I’m not sure what could be happening. I’d hate to say it, but have you tried rebooting your hub?

Yes, multiple times. This happened with one of Mariano’s drivers.

For WU…

If you want access to an API key, I can send you mine as test. getting current conditions is:

KNCROCKY49 is my personal station.

https://api.weather.com/v2/pws/observations/current?stationId=KNCROCKY49&format=json&units=e&apiKey=user_must_have_key_on_account

ping me offline and I can let you use my key.

the only limitation is how many hits/day for free access. So having ability to set often to get data is beneficial. I had GoogleSheets running every 10-15min for current and 1/hour for daily trends.

output looks like:

{“observations”:[{“stationID”:“KNCROCKY49”,“obsTimeUtc”:“2022-09-06T12:27:01Z”,“obsTimeLocal”:“2022-09-06 08:27:01”,“neighborhood”:“Rocky Mount”,“softwareType”:“GW1000B_V1.7.4”,“country”:“US”,“solarRadiation”:57.5,“lon”:-77.808998,“realtimeFrequency”:null,“epoch”:1662467221,“lat”:36,“uv”:0.0,“winddir”:224,“humidity”:91,“qcStatus”:1,“imperial”:{“temp”:77,“heatIndex”:78,“dewpt”:74,“windChill”:77,“windSpeed”:1,“windGust”:2,“pressure”:29.99,“precipRate”:0.00,“precipTotal”:0.00,“elev”:144}}]}

There are other API calls for historical data, but ST not really setup for trend charts…

ie
https://api.weather.com/v2/pws/observations/all/1day?stationId=KNCROCKY49&format=json&units=e&apiKey=user_must_have_key_on_account

gets you today with 5minute time slices. of all readings.

james

1 Like

Hi @TAustin, sorry for my dumbest question… but I can’t run Edge Bridge:

MacBook-Pro-Diego:~ diegoguerra$ python3 edgebridge.py
  File "/Users/diegoguerra/edgebridge.py", line 99
    else:
    ^^^^
SyntaxError: invalid syntax

Have I do something wrong?

That’s odd; Can you check what version Python you are running?

python —v

Here is it:

Python 3.10.7

By any chance did you try to edit the file and maybe accidently changed it? The reason I ask is that the error message indicates line 99 contains an ‘else:’, but if you have the most recent downloaded version, that shouldn’t be the case.

I suspect it, then downloaded again… but the same

One problem I have noted when using Open Weather is that the due point temperature is always 32.

Currently one locations has a temperature of 65.6F and 100% relative humidity, but the due point is 32. My other location is 64.2F and 89% RH again with a due point of 32.

I am using received temperature in Celsius and displayed temperature in Fahrenheit.

Yes, I think this is a bit of a nuisance problem. There actually is no dew point available from OW, so the driver defaults to 0, which is 0 degrees C, or 32 degrees F. :slight_smile:

So I will look at just setting to the lowest value (-20) to make it more obvious that it’s not available.

Not at problem, if it can’t be fixed.

I don’t have a Mac, so can’t experiment, but have you tried:

python edgebridge.py

So instead of ‘python3’ use ‘python’.