HA-YandexWeather: Unknown error occurred

При попытке настройки (вводим ключ, latlon…) появляется ошибка Unknown error occurred В консоли http://…:8123/api/config/config_entries/flow/d349e7333fb14ab19dd85ec7cb4d234c
`500 Internal Server Error

Server got itself in trouble`

в логах

Logger: aiohttp.server
Source: custom_components/yandex_weather/config_flow.py:111
Integration: Яндекс.Погода (documentation, issues)
First occurred: 07:44:41 (3 occurrences)
Last logged: 07:49:01

Error handling request

Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/aiohttp/web_protocol.py", line 435, in _handle_request
    resp = await request_handler(request)
  File "/usr/local/lib/python3.9/site-packages/aiohttp/web_app.py", line 504, in _handle
    resp = await handler(request)
  File "/usr/local/lib/python3.9/site-packages/aiohttp/web_middlewares.py", line 117, in impl
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/security_filter.py", line 60, in security_filter_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/forwarded.py", line 98, in forwarded_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/request_context.py", line 28, in request_context_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/ban.py", line 78, in ban_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/auth.py", line 181, in auth_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/view.py", line 137, in handle
    result = await result
  File "/usr/src/homeassistant/homeassistant/components/config/config_entries.py", line 157, in post
    return await super().post(request, flow_id)
  File "/usr/src/homeassistant/homeassistant/components/http/data_validator.py", line 62, in wrapper
    result = await method(view, request, *args, **kwargs)
  File "/usr/src/homeassistant/homeassistant/helpers/data_entry_flow.py", line 110, in post
    result = await self._flow_mgr.async_configure(flow_id, data)
  File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 252, in async_configure
    result = await self._async_handle_step(flow, cur_step["step_id"], user_input)
  File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 325, in _async_handle_step
    result: FlowResult = await getattr(flow, method)(user_input)
  File "/config/custom_components/yandex_weather/config_flow.py", line 53, in async_step_user
    if await _is_online(
  File "/config/custom_components/yandex_weather/config_flow.py", line 111, in _is_online
    return True if "fact" in weather.weather_data.keys() else False
AttributeError: 'NoneType' object has no attribute 'keys'

About this issue

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

Most upvoted comments

Разобрались… А я пошел придумывать как это лучше сообщать пользователю…

Начиная с v0.4.2 в интерфейсе будут человекочитаемые сообщения, а в логе записи вида:

2022-01-25 13:58:07 INFO (MainThread) [custom_components.yandex_weather.updater] Sending API request
2022-01-25 13:58:07 ERROR (MainThread) [custom_components.yandex_weather.updater] Could not get data from API: <ClientResponse(https://api.weather.yandex.ru/v2/informers?lat=55.8502705&lon=37.419719239&lang=en_US) [403 Forbidden]>
<CIMultiDictProxy('Content-Encoding': 'gzip', 'Content-Length': '38', 'Content-Type': 'text/plain; charset=utf-8', 'Date': 'Tue, 25 Jan 2022 10:58:07 GMT', 'Vary': 'Accept-Encoding', 'X-Content-Type-Options': 'nosniff', 'X-Yandex-Req-Id': '16431082dsdffsd256-372345561600007-sas5-6484-1.3tt5zkgzbxa62pkh')>
2022-01-25 13:58:07 ERROR (MainThread) [custom_components.yandex_weather.updater] Error requesting yandex_weather data: (403, 'Forbidden\n')
2022-01-25 13:58:07 DEBUG (MainThread) [custom_components.yandex_weather.updater] Finished fetching yandex_weather data in 0.068 seconds (success: False)

вместо трэйсов.

It works, needed to wait for 10-15 minutes after the new weather API key was created

Попробуйте перейти на тариф “погода для сайта”.