Skip to content

Commit a160743

Browse files
author
dave_albright
committed
v2.0.9
replace removed python async_timeout.timeout with asyncio.timeout addresses issues in discussion #s 260 and 261
1 parent a968b0d commit a160743

File tree

4 files changed

+11
-7
lines changed

4 files changed

+11
-7
lines changed

changelog.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1-
v2.08
1+
v2.0.9
2+
replace removed python async_timeout.timeout with asyncio.timeout
3+
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)
4+
5+
v2.0.8
26
modify Forecast Summary sensor initialization.
37
when integration was loaded after 3:00 pm apparent time, None was set as value type instead of string, causing failure.
48
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)

custom_components/wundergroundpws/config_flow.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
from __future__ import annotations
33
import logging
44
from http import HTTPStatus
5-
import async_timeout
5+
from asyncio import timeout
66
import voluptuous as vol
77
from homeassistant import config_entries
88
import homeassistant.helpers.config_validation as cv
@@ -55,7 +55,7 @@ async def async_step_user(self, user_input=None):
5555
errors["base"] = "invalid_station_id"
5656
raise InvalidStationId
5757

58-
with async_timeout.timeout(DEFAULT_TIMEOUT):
58+
async with timeout(DEFAULT_TIMEOUT):
5959
url = f'https://api.weather.com/v2/pws/observations/current?stationId={pws_id}&format=json&units=e' \
6060
f'&apiKey={api_key}'
6161
response = await session.get(url, headers=headers)

custom_components/wundergroundpws/coordinator.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
from typing import Any
1010

1111
import aiohttp
12-
import async_timeout
12+
from asyncio import timeout
1313

1414
from homeassistant.core import HomeAssistant
1515
from homeassistant.exceptions import HomeAssistantError
@@ -122,7 +122,7 @@ async def get_weather(self):
122122
"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"
123123
}
124124
try:
125-
with async_timeout.timeout(DEFAULT_TIMEOUT):
125+
async with timeout(DEFAULT_TIMEOUT):
126126
url = self._build_url(_RESOURCECURRENT)
127127
response = await self._session.get(url, headers=headers)
128128
result_current = await response.json()
@@ -135,7 +135,7 @@ async def get_weather(self):
135135
if not self._latitude:
136136
self._latitude = (result_current[FIELD_OBSERVATIONS][0][FIELD_LATITUDE])
137137

138-
with async_timeout.timeout(DEFAULT_TIMEOUT):
138+
async with timeout(DEFAULT_TIMEOUT):
139139
url = self._build_url(_RESOURCEFORECAST)
140140
response = await self._session.get(url, headers=headers)
141141
result_forecast = await response.json()

custom_components/wundergroundpws/manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"domain": "wundergroundpws",
33
"name": "Wundergroundpws",
4-
"version": "2.0.8",
4+
"version": "2.0.9",
55
"documentation": "https://github.com/cytech/Home-Assistant-wundergroundpws/",
66
"issue_tracker": "https://github.com/cytech/Home-Assistant-wundergroundpws/discussions/",
77
"requirements": [],

0 commit comments

Comments
 (0)