Skip to content

Commit

Permalink
v2.0.9
Browse files Browse the repository at this point in the history
replace removed python async_timeout.timeout with asyncio.timeout
addresses issues in discussion #s 260 and 261
  • Loading branch information
dave_albright committed Nov 8, 2024
1 parent a968b0d commit a160743
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 7 deletions.
6 changes: 5 additions & 1 deletion changelog.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
v2.08
v2.0.9
replace removed python async_timeout.timeout with asyncio.timeout
addresses issues in discussion #s [260](https://github.com/cytech/Home-Assistant-wundergroundpws/discussions/260) and [261](https://github.com/cytech/Home-Assistant-wundergroundpws/discussions/261)

v2.0.8
modify Forecast Summary sensor initialization.
when integration was loaded after 3:00 pm apparent time, None was set as value type instead of string, causing failure.
addresses issues in discussion #s [248](https://github.com/cytech/Home-Assistant-wundergroundpws/discussions/248) and [246](https://github.com/cytech/Home-Assistant-wundergroundpws/discussions/246)
Expand Down
4 changes: 2 additions & 2 deletions custom_components/wundergroundpws/config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from __future__ import annotations
import logging
from http import HTTPStatus
import async_timeout
from asyncio import timeout
import voluptuous as vol
from homeassistant import config_entries
import homeassistant.helpers.config_validation as cv
Expand Down Expand Up @@ -55,7 +55,7 @@ async def async_step_user(self, user_input=None):
errors["base"] = "invalid_station_id"
raise InvalidStationId

with async_timeout.timeout(DEFAULT_TIMEOUT):
async with timeout(DEFAULT_TIMEOUT):
url = f'https://api.weather.com/v2/pws/observations/current?stationId={pws_id}&format=json&units=e' \
f'&apiKey={api_key}'
response = await session.get(url, headers=headers)
Expand Down
6 changes: 3 additions & 3 deletions custom_components/wundergroundpws/coordinator.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from typing import Any

import aiohttp
import async_timeout
from asyncio import timeout

from homeassistant.core import HomeAssistant
from homeassistant.exceptions import HomeAssistantError
Expand Down Expand Up @@ -122,7 +122,7 @@ async def get_weather(self):
"user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/111.0.0.0 Safari/537.36"
}
try:
with async_timeout.timeout(DEFAULT_TIMEOUT):
async with timeout(DEFAULT_TIMEOUT):
url = self._build_url(_RESOURCECURRENT)
response = await self._session.get(url, headers=headers)
result_current = await response.json()
Expand All @@ -135,7 +135,7 @@ async def get_weather(self):
if not self._latitude:
self._latitude = (result_current[FIELD_OBSERVATIONS][0][FIELD_LATITUDE])

with async_timeout.timeout(DEFAULT_TIMEOUT):
async with timeout(DEFAULT_TIMEOUT):
url = self._build_url(_RESOURCEFORECAST)
response = await self._session.get(url, headers=headers)
result_forecast = await response.json()
Expand Down
2 changes: 1 addition & 1 deletion custom_components/wundergroundpws/manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"domain": "wundergroundpws",
"name": "Wundergroundpws",
"version": "2.0.8",
"version": "2.0.9",
"documentation": "https://github.com/cytech/Home-Assistant-wundergroundpws/",
"issue_tracker": "https://github.com/cytech/Home-Assistant-wundergroundpws/discussions/",
"requirements": [],
Expand Down

0 comments on commit a160743

Please sign in to comment.