n0bel / PiClock

A Fancy Clock built around a monitor and a Raspberry Pi
MIT License
566 stars 182 forks source link

Open weather clock does not show 'wind', 'feels_like' and 'timestamp' due to missing wind_gust #196

Closed BertLindeman closed 3 years ago

BertLindeman commented 3 years ago

When using the open weather map key, the json returned does not contain wind_gusts.

The log reports that as

KeyError: 'wind_gust'

Do you want me to make a pull request to change this

        wind.setText(Config.LWind +
                     wd + ' ' +
                     '%.1f' % (speedm(f['wind_deg'])) + 'kmh' +
                     Config.Lgusting +
                     '%.1f' % (speedm(f['wind_gust'])) + 'kmh')

into this (and similar for non-metric)

        try:
            wind.setText(Config.LWind +
                     wd + ' ' +
                     '%.1f' % (speedm(f['wind_speed'])) + 'kmh' +
                     Config.Lgusting +
                     '%.1f' % (speedm(f['wind_gust'])) + 'kmh')
        except:  # No wind_gust available on open  weather map
            wind.setText(Config.LWind +
                     wd + ' ' +
                     '%.1f' % (speedm(f['wind_speed'])) + 'kmh')

Not sure:

[edit: wind_deg -> wind_speed ]

BertLindeman commented 3 years ago

Ugh... There is a copy/paste error in this area. Also in the original source We show wind_deg as if it was wind_speed

So I see now a wind_speed of 130 kph (~ 80 mile/hour) And there is hardly a breeze ;-)

feh123 commented 3 years ago

My upside is that weather underground and dark sky were both very good and hence were bought. I think this is their strategy - be good and get a lot of money when sold. So Climacell will be the same - hence V4? Even OWM - not sure but if MS can buy Github who knows?

On Tuesday, 29 December 2020, 08:45:32 GMT, Bert <notifications@github.com> wrote:  

Ugh... There is a copy/paste error in this area. Also in the original source We show wind_deg as if it was wind_speed

So I see now a wind_speed of 130 kph (~ 80 mile/hour) And there is hardly a breeze ;-)

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or unsubscribe.

n0bel commented 3 years ago

Commit https://github.com/n0bel/PiClock/commit/6491c57da2ccfa4d6d4c2675ac604c3ee64d8ba1
Corrected metric wind_speed (from wind_deg) and wind_gust is now optional based on the return values.

BertLindeman commented 3 years ago

Confirmed working with and without wind_gust

Thanks, @n0bel