Pirate-Weather / pirate-weather-ha

Replacement for the default Dark Sky Home Assistant integration using Pirate Weather
https://pirateweather.net/
Apache License 2.0
369 stars 26 forks source link

HACS Home Assistant Integration: API gives very inaccurate weather data #220

Closed Jm-Fox closed 7 months ago

Jm-Fox commented 7 months ago

Describe the bug

First all, thanks for providing this tool and the free tier. I look forward to using it further.

Second, I don't expect perfect weather forecasts / current temperatures / etc. But for me to rely on it in home assistant, I do need values to be "good enough."

My (long form) issue is as follows:

The difference between Merry Sky and weather.com I think is easily explained by documented caching in Merry Sky (issues Pirate-Weather/pirateweather#30, Pirate-Weather/pirateweather#156). However, the API being off by 30 degrees and 2x humidity is wild. At first I questioned user error: bad coordinates, but after triple checking everything I'm still stuck. I apologize if this has been discussed elsewhere.

To my knowledge, I have been using the production API endpoint. If I can assist in verification by tweaking settings, I am able to (given instructions / links to documentation).

Expected behavior

Pirate API in Home Assistant to report approximate temperatures- within a few degrees of other services. Same for humidity.

Actual behavior

Pirate API in Home Assistant is reporting wildly different temperatures / humidity than other services, including Merry Sky, which should be operating on the same data (if a bit outdated due to caching forecasts).

API Endpoint

Production

Location

North Shiloh Road, Garland, Dallas County

Other details

I confess I did not fully read through the API documentation before opening the issue. Since I'm relying on the integration to make the API calls and am not making them personally, I assumed there'd be little value in my review of the api docs. I apologize if this should be an issue on the HA repository.

Troubleshooting steps

alexander0042 commented 7 months ago

Thanks for using this API/integration, and appreciate the issue report! I took a look at the raw API response: https://api.pirateweather.net/forecast/APIKEY/32.952199718765016,-96.66548605790446,1713717000&units=us from that time, and it's looking ok (57 degrees), so I'm thinking this is probably a case of the integration not updating for some reason. Do you mind taking a quick look in your logs and letting me know if you see anything from Pirate Weather?.

Jm-Fox commented 7 months ago

I'm new to this- how do I get the logs you need? Edit: a link to technical documentation is fine.

My best guess was:

  1. Enable debug logging from the Pirate Weather integration configuration page (home assistant -> /config/integrations/integration/pirateweather)
  2. Reload the integration
  3. Review entries in the Logbook tab of Home Assistant (see images below; it's currently ~63 degrees Fahrenheit outside, so the issue is still reproducing).
    • It's interesting that the daily forecast includes Sunday, when local time is ~10:45 am Monday. The hourly forecast at least has the correct timestamps on it.

image image

alexander0042 commented 7 months ago

Great question! The logs are visible in the WebUI here: https://homeassistant.local/config/logs, and you're looking for any line that starts with Pirate Weater- just search for it and see if anything comes up.

What's weird is looking at that it's not looking like an update issue, but rather something related to the data. Did you ever change the location it's requesting, since there's a limitation where you can't edit the location after it's been created.

Jm-Fox commented 7 months ago

That's it: I did change the location. I had goofed the longitude on my first attempt, missing the negative sign.

I confirmed Merry Sky gave the same data if I give it the positive longitude, then deleted and recreated the home assistant integration. All the numbers line up now.

For good measure I also reviewed the /config/logs URL and didn't see anything unusual (a timeout and a 502, but I know those things happen from time to time).

Thank you for your assistance!

alexander0042 commented 7 months ago

Great- happy that it's working! Good catch on the 502's, they're due to Lambda cold starting every so often; however, shouldn't be a problem for much longer since V2 moves it over to a docker setup