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()