naofireblade / homebridge-weather-plus

A comprehensive weather plugin for homebridge.
MIT License
315 stars 63 forks source link

Error retrieving weather report: undefined #282

Closed daciand closed 5 months ago

daciand commented 7 months ago

From time to time I get the following error: [2/10/2024, 4:30:13 AM] [WeatherPlus] Error retrieving weather report [2/10/2024, 4:30:13 AM] [WeatherPlus] undefined

Here is my plugin configuration: { "units": "si", "interval": 5, "stations": [ { "nameNow": "Outside Weather", "service": "openweathermap", "key": "f057d50b12ae0d055392d812f0175042", "locationGeo": [ 44.48871425, 26.09597057 ], "locationCity": "Bucharest, RO", "language": "en", "compatibility": "eve", "conditionCategory": "simple", "now": true, "extraHumidity": false, "hidden": [ "Air Pressure", "Cloud Cover", "Condition", "Condition Category", "Dew Point", "Forecast Day", "Observation Station", "Observation Time", "Ozone", "Rain", "Rain 1h", "Rain Day", "Rain Chance", "Snow", "Solar Radiation", "Sunrise Time", "Sunset Time", "Temperature Min", "Temperature Apparent", "UV Index", "Visibility", "Wind Direction", "Wind Speed", "Wind Speed Max" ] } ], "platform": "WeatherPlus" }

Other Homebridge details:

dacarson commented 7 months ago

Do you know if you are using the 2.5 API or the 3.0 API?

daciand commented 7 months ago

I have no idea. How do I find out?

dacarson commented 7 months ago

Just after a restart, you may see a line: [13/02/2024, 10:48:02] [WeatherPlus] Could not retreive weather report with API 3.0, trying API 2.5 now ... Or if you are not paying money to OpenWeatherMap, then you most likely are using 2.5

dacarson commented 7 months ago

My first guess at why you might see that occasionally is because you are hitting the request limit. But, if I do a back of the envelope calculation it seems fine. Interval of 5mins, that's 12 requests per hour. Which is less than 60 calls per minute. Interval of 5mins, that's 8,640 requests per month. Which is less than 1,000,000 per month.

When I check the code, we are unfortunately not logging the error that is returned. We are only logging the response, which is undefined. Need to change to code to also log the returned error.

daciand commented 7 months ago

I am not paying, therefore I must be using 2.5.

Should I wait for a new version to get more logging and come back afterwards?

dacarson commented 7 months ago

Should I wait for a new version to get more logging and come back afterwards?

Yes. Right now there is not enough information in the logs to understand why you might occasionally see the error message.

CGCode1000 commented 7 months ago

daciand- I was previously on 2.5 and just upgraded to 3.0. You have to give a credit card, you get 1,000 API calls per day for free and you can set your daily limit at 1,000 (default is 2,000- just change to 1,000), which means you should never incur a charge. Here is the subscribe page if you choose to upgrade: https://openweathermap.org/api

CG

dacarson commented 6 months ago

Please try 3.3.4-beta.1 and see if the error happens again.

daciand commented 6 months ago

I have just upgraded the plugin to the version you recommended:

[3/28/2024, 2:58:11 PM] Loaded plugin: homebridge-weather-plus@3.3.4-beta.1 [3/28/2024, 2:58:11 PM] Registering platform 'homebridge-weather-plus.WeatherPlus' [3/28/2024, 2:58:11 PM] [WeatherPlus] Initializing WeatherPlus platform... [3/28/2024, 2:58:11 PM] [WeatherPlus] Adding station with weather service OpenWeatherMap named 'Outside Weather' [3/28/2024, 2:58:11 PM] Initializing platform accessory 'Outside Weather'... [3/28/2024, 2:58:12 PM] [WeatherPlus] Could not retreive weather report with API 3.0, trying API 2.5 now ... [3/28/2024, 2:58:12 PM] Homebridge v1.7.0 (HAP v0.11.1) (homebridge-vieramatic) is running on port 56356. [3/28/2024, 2:58:12 PM] [homebridge-weather-plus] This plugin generated a warning from the characteristic 'Air Pressure': Characteristic not in required or optional characteristic section for service TemperatureSensor. Adding anyway.. See https://homebridge.io/w/JtMGR for more info. [3/28/2024, 2:58:12 PM] [homebridge-weather-plus] This plugin generated a warning from the characteristic 'Current Ambient Light Level': Characteristic not in required or optional characteristic section for service TemperatureSensor. Adding anyway.. See https://homebridge.io/w/JtMGR for more info.

Everything seems to be fine for now. I'll come back later with some feedback.

Thank you!

daciand commented 5 months ago

The issue seems to be fixed for good. I didn't encounter it again, therefore this ticket can be closed.

Thank you!