core: wunderground API call wrong

The problem

The API call to the Weather Underground API does not work. The API called is api.wunderground.com, according to the documentation (which can be found here: https://docs.google.com/document/d/1KGb8bTVYRsNgljnNH67AMhckY8AQT2FVwZ9urj8SWBs/edit) it should be api.weather.com

Environment

  • Home Assistant Core release with the issue: 0.110.3
  • Last working Home Assistant Core release (if known): unknown
  • Operating environment (Home Assistant/Supervised/Docker/venv): Raspberry Pi4 (4 GB), Raspbian, Docker
  • Integration causing this issue: wunderground
  • Link to integration documentation on our website: https://www.home-assistant.io/integrations/wunderground/

Problem-relevant configuration.yaml

  - platform: wunderground
    api_key: !secret wunderground_api_key 
    pws_id: I21TRGZR3
    monitored_conditions:
      - location
      - solarradiation        

Traceback/Error logs

Log Details (ERROR)
Logger: homeassistant.components.wunderground.sensor
Source: components/wunderground/sensor.py:1091
Integration: wunderground (documentation, issues)
First occurred: 6:39:29 AM (1 occurrences)
Last logged: 6:39:29 AM

Error fetching WUnderground data: ContentTypeError("0, message='Attempt to decode JSON with unexpected mimetype: text/plain; charset=utf-8', url='http://api.wunderground.com/api/183bed2b1da449f3bbed2b1da4a9f386/conditions/lang:EN/q/pws:I21TRGZR3.json")
Connection lost. Reconnecting…

Additional information

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 2
  • Comments: 15 (7 by maintainers)

Most upvoted comments

@home-assistant @frenck This has been an issue for about 1.5 years now, see: #22225 & #26564. Since there is no codeowner mentioned for this integration, nothing is done with it, and at some point the issue gets closed for being stale. Something should be done about it. Either it should be officially removed from HomeAssistant, or a fix should be applied.

It would be great to get this integration sorted again, even if it is just for importing PWS data. I’m happy to help if someone can point me in the right direction.

The problem still exists in HA Version 2020.12.6

Error fetching WUnderground data: ContentTypeError(RequestInfo(url=URL('http://api.wunderground.com/api/<api-key-removed-here>/alerts/conditions/lang:EN/q/pws:IBADENWR90.json'), method='GET', headers=<CIMultiDictProxy('Host': 'api.wunderground.com', 'User-Agent': 'HomeAssistant/0.118.5 aiohttp/3.7.1 Python/3.8', 'Accept': '*/*', 'Accept-Encoding': 'gzip, deflate')>, real_url=URL('http://api.wunderground.com/api/<api-key-removed-here>/alerts/conditions/lang:EN/q/pws:IBADENWR90.json')), (), message='Attempt to decode JSON with unexpected mimetype: text/plain; charset=utf-8', headers=<CIMultiDictProxy('Server': 'awselb/2.0', 'Content-Type': 'text/plain; charset=utf-8', 'Content-Length': '19', 'Expires': 'Sun, 13 Dec 2020 18:21:21 GMT', 'Cache-Control': 'max-age=0, no-cache', 'Pragma': 'no-cache', 'Date': 'Sun, 13 Dec 2020 18:21:21 GMT', 'Connection': 'keep-alive', 'X-Origin-Hint': 'Default')>)

Looking into the source file wunderground/sensor.py it is clearly still using the wrong API.

Could you please add a warning to the integration page wunderground that this integration is not working. I spend a lot of time with the configuration files better spend on fixing the bug. Beginners will not be able to find this bug.

I am offering to test - as I have still access to an API key at weather underground.

Fresh install today… first time playing with home assistant. While the whole thing kicks ass, this will be the reason why weather underground doesn’t work for me. I thought I was going crazy. @rhadamantys ill try and have a look at your solution

I have the same issue in version 0.112. Seems like the integration is not using the correct URL. according to the API documentation the HTTPS call should be: https://api.weather.com/v2/pws/observations/current?stationId=KMAHANOV10&format=json&units=e&apiKey=yourApiKey

According to my logfiles the call now is: http://api.wunderground.com/api/<API_key>/alerts/almanac/conditions/forecast/lang:EN/q/pws:<station_ID>.json

I tested it by performing a manual call to the first URL, that is returning values. The second one is not.