yandex_weather icon indicating copy to clipboard operation
yandex_weather copied to clipboard

Attempt to decode JSON with unexpected mimetype: text/plain; charset=utf-8

Open megane999 opened this issue 3 years ago • 2 comments

Ошибка в декодировании JSON

[custom_components.yandex_weather.weather] Error fetching data from Yandex.Weather, 0, message='Attempt to decode JSON with unexpected mimetype: text/plain; charset=utf-8', url=URL('https://api.weather.yandex.ru/v2/informers?lat=55.xxxxxx&lon=49.xxxxxx')

геолокацию скрыл

megane999 avatar May 30 '21 12:05 megane999

Запросы api отличаются в зависимости от выбранного тарифа. Если выбран тариф "Тестовый", то запрос в строке 247 (informers) base_url="https://api.weather.yandex.ru/v2/informers?lat=%s&lon=%s" % (self._lat, self._lon) Надо поменять на (forecast) на base_url="https://api.weather.yandex.ru/v2/forecast?lat=%s&lon=%s" % (self._lat, self._lon)

https://yandex.ru/dev/weather/doc/dg/concepts/forecast-test.html

AlexanderOleynik avatar Jun 03 '21 10:06 AlexanderOleynik

Кстати, не забывайте, что API ключ в yaml-е нужно писать в кавычках, я так долго тупил в чём дело

Egor3f avatar Dec 20 '21 16:12 Egor3f