naofireblade / homebridge-weather-plus

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

thresholdCloudCover on openweathermap.org #286

Closed CGCode1000 closed 7 months ago

CGCode1000 commented 7 months ago

Using openweathermap.org for API I have never been able to get a value to stick in the Config field "Threshold for cloud cover sensor". My work around was to edit the "JSON Config" directly and add the following: "thresholdCloudCover: 50". Everything worked fine up until the past week or so, Accessory for Cloud cover constantly shows "Cloud Cover: 0" despite openweathermap.org direct API showing 100. Accessories for temp, air pressure etc.. all show correct values so I know the API is working. There seems to be an issue only with plugin reading thresholdCloudCover.

JSON Config: "locationCity": "XXXX", "language": "en", "compatibility": "both", "conditionCategory": "simple", "now": true, "extraHumidity": false, "thresholdCloudCover": 50

URL API Results: {"coord":{"lon":XXXXX,"lat":XXXXX},"weather":[{"id":804,"main":"Clouds","description":"overcast clouds","icon":"04d"}],"base":"stations","main":{"temp":279.44,"feels_like":278.23,"temp_min":277.6,"temp_max":281.17,"pressure":1010,"humidity":64},"visibility":10000,"wind":{"speed":1.79,"deg":246,"gust":3.58},"clouds":{"all":100},"dt":1707768005,"sys":{"type":2,"id":2005400,"country":"US","sunrise":1707738771,"sunset":1707776643},"timezone":-18000,"id":5122638,"name":"XXXXXXX","cod":200}

CGCode1000 commented 7 months ago

To further troubleshoot, can someone tell me where I can find on my hard drive (or the exact file name) of the current data that homebridge-weather-plus is pulling in from openweathermap.org API?

thanks

dacarson commented 7 months ago

The data is not stored to the hard drive. The data is fetched from OpenWeatherMap and is cached in memory. Do you know if you are using the legacy 2.5 API, or the new OneCall 3.0 API?

Looking at the URL results, it looks like the legacy 2.5API "clouds":{"all":100},

CGCode1000 commented 7 months ago

David- Thanks for responding. According to the logs 2.5 API

dacarson commented 7 months ago

I see that you are using compatibility: both. Can you tell me which app you are using to view the values? Apple's Home app, Eve app, Home+ or something else. Is Wind Dir: and Wind Speed: also updating? I ask as there is an issue #247 where the tiles were not updating in the compatibility mode.

CGCode1000 commented 7 months ago

I am using Homebridge Accessory page (MacOS) to see the values. Both Wind Dir: and Wind Speed show values.

HomeKit on iOS shows Air Pressure, Cloud Cover, Rain, Snow, UV Index, Wind Direction and Wind Speed however no values other than triggered for Air Pressure.

I just toggled Compatibility from "Apple Home ( plus Eve)" to "Apple Home" but logs still show 2.5 API is being used ("Could not retreive weather report with API 3.0, trying API 2.5 now ."

CGCode1000 commented 7 months ago

David- Cloud cover occupancy just triggered on its own. URL pull now shows "clouds":{"all":40}. Perhaps there is an issue with interpreting 100 as over threshold?

dacarson commented 7 months ago

Using openweathermap.org for API I have never been able to get a value to stick in the Config field "Threshold for cloud cover sensor". My work around was to edit the "JSON Config" directly and add the following: "thresholdCloudCover: 50".

FYI, I see this too. If I set a value in the config UI, and then check the JSON file, the value isn't there.

CGCode1000 commented 7 months ago

correct- and it will erase the entire thresholdCloudCover line in the JSON file if it was there.

dacarson commented 7 months ago

Found the issue. A typo. The config file tries to load/save 'tresholdCloudCover' but the UI field is called 'thresholdCloudCover'.

dacarson commented 7 months ago

Misspelling called out first #122

dacarson commented 7 months ago

I tried hard coding in the URL response you got, and it complains about the temperatures being above max.: {"temp":279.44,"feels_like":278.23,"temp_min":277.6,"temp_max":281.17 And HomeKit is reporting errors. I wonder if there was an error like this and it stopped processing the data before it hit Cloud Cover.

dacarson commented 7 months ago

I did try hard coding just "clouds":{"all":100} and it worked fine, and I also tried the entire URL response you specified above and it also work (with the exception of the temperatures). In both cases I get Cloud Cover 100%. I'm not sure why it isn't working.

CGCode1000 commented 7 months ago

David- all seems to be functioning again. Homebridge accessory for "Cloud Cover" shows 100 (triggered) which matches current URL API. I am not sure what the issue was but it has been working since my earlier post "Cloud cover occupancy just triggered on its own". After it started working again I updated to API version 3.0 just in case that had something to do with the problem. I will keep a close eye on it for the next few days. Thanks so much for your help.

CGCode1000 commented 7 months ago

David- homebridge-weather-plus continues to function well. By the way I found out that the openweathermap.org API URL response I gave you yesterday was in Kelvin. In order to return Fahrenheit or Celsius the URL needed to contain either &units=imperial or &units=metric. Thanks for all of your efforts- the plugin has become an integral part of my automations.

dacarson commented 7 months ago

Glad that it is still working. The issue with the Threshold not sticking in the configuration UI, I will track with #122 Maybe we can close this issue then :-)

CGCode1000 commented 5 months ago

UPDATE: For anyone that stumbles across this thread that is having trouble with the "Cloud Cover" accessory tile in the Homebridge Accessories tab showing either no numerical value or an incorrect numerical value the solution is to click on the edit gear in the upper right corner of the "Cloud Cover" accessory tile and clear the entire Name field (text and any numbers that exist), you should immediately see the field repopulate with "Cloud Cover:" followed by the correct numerical value. Lastly, make sure to click the "Close" button on the bottom of the overlay box.