diff --git a/homeassistant/components/openuv/coordinator.py b/homeassistant/components/openuv/coordinator.py index eb5970edef5..b29d272b0ec 100644 --- a/homeassistant/components/openuv/coordinator.py +++ b/homeassistant/components/openuv/coordinator.py @@ -68,7 +68,7 @@ class OpenUvCoordinator(DataUpdateCoordinator[dict[str, Any]]): class OpenUvProtectionWindowCoordinator(OpenUvCoordinator): - """Define an OpenUV data coordinator for the protetction window.""" + """Define an OpenUV data coordinator for the protection window.""" _reprocess_listener: CALLBACK_TYPE | None = None @@ -76,10 +76,18 @@ class OpenUvProtectionWindowCoordinator(OpenUvCoordinator): data = await super()._async_update_data() for key in ("from_time", "to_time", "from_uv", "to_uv"): - if not data.get(key): - msg = "Skipping update due to missing data: {key}" + # a key missing from the data is an error. + if key not in data: + msg = f"Update failed due to missing data: {key}" raise UpdateFailed(msg) + # check for null or zero value in the data & skip further processing + # of this update if one is found. this is a normal condition + # indicating that there is no protection window. + if not data[key]: + LOGGER.warning("Skipping update due to missing data: %s", key) + return {} + data = self._parse_data(data) data = self._process_data(data)