k-donn / plasmoid-wunderground

A Plasma 5/6 widget for showing data from Wunderground PWS
https://store.kde.org/p/2135799
GNU General Public License v2.0
39 stars 15 forks source link

Weak station connection or client loses connnection the data will never update #11

Closed biyori closed 3 years ago

biyori commented 3 years ago

I'm still trying to debug if the remote station has issues or me (probably me)

Using this wunderground station

https://www.wunderground.com/dashboard/pws/KCAFRESN59

It works for a few hours but over time it will give the message below

error

From this point on the weather station will never move past this error and to fix it you have to swap stations and then go back to the original station.

Feb 26 15:35:49 ArchDatAss plasmashell[1235]: qml: [debug] id changed
Feb 26 15:35:49 ArchDatAss plasmashell[1235]: qml: [debug] state is: 2
Feb 26 15:35:49 ArchDatAss plasmashell[1235]: qml: [debug] getting new weather data
Feb 26 15:35:49 ArchDatAss plasmashell[1235]: qml: [debug] https://api.weather.com/v2/pws/observations/current?stationId=KCAFRESN59&format=json&units=e&apiKey=6532d6454b8aa370768e63d6ba5a832e&numericPrecision=decimal
Feb 26 15:35:49 ArchDatAss plasmashell[1235]: qml: [debug] https://api.weather.com/v1/geocode///forecast/daily/7day.json?apiKey=6532d6454b8aa370768e63d6ba5a832e&language=en-US&units=e
Feb 26 15:35:49 ArchDatAss plasmashell[1235]: qml: [debug] Could not fetch forecast data
Feb 26 15:35:49 ArchDatAss plasmashell[1235]: qml: [debug] state is: 4
Feb 26 15:35:50 ArchDatAss plasmashell[1235]: qml: [debug] weather data changed
Feb 26 15:35:50 ArchDatAss plasmashell[1235]: qml: [debug] https://api.weather.com/v3/wx/observations/current?geocode=,&apiKey=6532d6454b8aa370768e63d6ba5a832e&language=en-US&units=e&format=json
Feb 26 15:35:50 ArchDatAss plasmashell[1235]: qml: [debug] Got new current data
Feb 26 15:35:50 ArchDatAss plasmashell[1235]: qml: [debug] state is: 8
k-donn commented 3 years ago

Looking at the API requests, the second API request is missing the geocode coordinates (the one to here). I cannot get to my computer right now so there is not anything I can do. However, the next time there is an error go to the PWS Observation URL and check if there is the lat and lon properties. This will help me when I can get to my computer. Thanks!

biyori commented 3 years ago

Okay I rebooted and for some reason it sends a request before I connected to the wifi or something and stops here:

Feb 26 19:13:33 ArchDatAss plasmashell[10969]: qml: [debug] state is: 1
Feb 26 19:13:33 ArchDatAss plasmashell[10969]: qml: [debug] id changed
Feb 26 19:13:33 ArchDatAss plasmashell[10969]: qml: [debug] state is: 2
Feb 26 19:13:33 ArchDatAss plasmashell[10969]: qml: [debug] getting new weather data
Feb 26 19:13:33 ArchDatAss plasmashell[10969]: qml: [debug] units changed
Feb 26 19:13:33 ArchDatAss plasmashell[10969]: qml: [debug] getting new weather data
Feb 26 19:13:33 ArchDatAss plasmashell[10969]: qml: [debug] https://api.weather.com/v2/pws/observations/current?stationId=KCAFRESN59&format=json&units=e&apiKey=6532d6454b8aa370768e63d6ba5a832e&numericPrecision=decimal
Feb 26 19:13:33 ArchDatAss plasmashell[10969]: qml: [debug] https://api.weather.com/v1/geocode/36.820328/-119.761322/forecast/daily/7day.json?apiKey=6532d6454b8aa370768e63d6ba5a832e&language=en-US&units=e
Feb 26 19:13:33 ArchDatAss plasmashell[10969]: qml: [debug] https://api.weather.com/v2/pws/observations/current?stationId=KCAFRESN59&format=json&units=e&apiKey=6532d6454b8aa370768e63d6ba5a832e&numericPrecision=decimal
Feb 26 19:13:33 ArchDatAss plasmashell[10969]: qml: [debug] https://api.weather.com/v1/geocode/36.820328/-119.761322/forecast/daily/7day.json?apiKey=6532d6454b8aa370768e63d6ba5a832e&language=en-US&units=e
Feb 26 19:13:33 ArchDatAss plasmashell[10969]: qml: [debug] ////////////////////////////////////////
Feb 26 19:13:33 ArchDatAss plasmashell[10969]: qml: [debug] false
Feb 26 19:13:33 ArchDatAss plasmashell[10969]: qml: [debug] ////////////////////////////////////////
Feb 26 19:13:34 ArchDatAss plasmashell[10969]: qml: [debug] Request failed:
Feb 26 19:13:34 ArchDatAss plasmashell[10969]: qml: [debug] state is: 4
Feb 26 19:13:34 ArchDatAss plasmashell[10969]: qml: [debug] Request couldn't be sent
Feb 26 19:13:34 ArchDatAss plasmashell[10969]: qml: [debug] Could not fetch forecast data
Feb 26 19:13:34 ArchDatAss plasmashell[10969]: qml: [debug] Request failed:
Feb 26 19:13:34 ArchDatAss plasmashell[10969]: qml: [debug] Request couldn't be sent
Feb 26 19:13:34 ArchDatAss plasmashell[10969]: qml: [debug] Could not fetch forecast data
k-donn commented 3 years ago

Okay thanks! Plasma sending the request before you connect to WiFi is a Plasma problem. However, I could solve the

never mov[ing] past this error and to fix it you have to swap stations and then go back to the original station.

problem by removing the running condition in main.qml. This would mean that the plasmoid would continue sending requests until you connect to WiFi. I am getting on this.