2017-01-05, 17:38
(2017-01-05, 07:46)Medlir Wrote: It's due to Yahoo's own API returning results of null and how the plugin handles that response. Their own Weather API example page is intermittently throwing nulls when you click the Test button here:
https://developer.yahoo.com/weather/
Basically, the forecast method calls get_weather, then if it gets a response, parses it, then calls the properties method... where it checks if the data is as expected... but if it's not (results response is null) it never sets the properties storing the weather data to anything at all. And presumably then Kodi just pulls garbage data when it tries to getProperty those values, but I really still don't know where it's getting them from. Confirmed in the debug log that when getting a null response it shows random data. This being on 3.3.2.
The best and simplest solution is for Yahoo to just fix their API.
One simple fix though that seems to work, and is super easy to make by anyone who doesn't mind editing the Python, would be to call clear() as an else condition of the first long if check in the properties method... if we get that far, but have no data, it will then set everything to it's default N/A values. You still don't have data... but it's not random crazy data, it's nice known default data.
I wrote some code to do that, but also to store the last known good data for a location in addon_data, and on null response pull that last known stale data back in. Submitted a pull request on github for it.
Nice!! Thanks for the clarification.