From 2883aacfa3be98f009a12ad5f58dc9454ccfb842 Mon Sep 17 00:00:00 2001 From: Phil Bruckner Date: Wed, 17 Jun 2020 15:40:04 -0500 Subject: [PATCH] Fix yr HTTP error handling (#36889) --- homeassistant/components/yr/sensor.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/homeassistant/components/yr/sensor.py b/homeassistant/components/yr/sensor.py index 58a04ce62a6..8d7a91f24da 100644 --- a/homeassistant/components/yr/sensor.py +++ b/homeassistant/components/yr/sensor.py @@ -21,7 +21,7 @@ from homeassistant.const import ( DEVICE_CLASS_HUMIDITY, DEVICE_CLASS_PRESSURE, DEVICE_CLASS_TEMPERATURE, - HTTP_OK, + HTTP_BAD_REQUEST, PRESSURE_HPA, SPEED_METERS_PER_SECOND, TEMP_CELSIUS, @@ -187,7 +187,7 @@ class YrData: websession = async_get_clientsession(self.hass) with async_timeout.timeout(10): resp = await websession.get(self._url, params=self._urlparams) - if resp.status != HTTP_OK: + if resp.status >= HTTP_BAD_REQUEST: try_again(f"{resp.url} returned {resp.status}") return text = await resp.text()