File tree Expand file tree Collapse file tree 1 file changed +11
-3
lines changed
homeassistant/components/openuv Expand file tree Collapse file tree 1 file changed +11
-3
lines changed Original file line number Diff line number Diff line change @@ -68,18 +68,26 @@ async def _async_update_data(self) -> dict[str, Any]:
6868
6969
7070class OpenUvProtectionWindowCoordinator (OpenUvCoordinator ):
71- """Define an OpenUV data coordinator for the protetction window."""
71+ """Define an OpenUV data coordinator for the protection window."""
7272
7373 _reprocess_listener : CALLBACK_TYPE | None = None
7474
7575 async def _async_update_data (self ) -> dict [str , Any ]:
7676 data = await super ()._async_update_data ()
7777
7878 for key in ("from_time" , "to_time" , "from_uv" , "to_uv" ):
79- if not data .get (key ):
80- msg = "Skipping update due to missing data: {key}"
79+ # a key missing from the data is an error.
80+ if key not in data :
81+ msg = f"Update failed due to missing data: { key } "
8182 raise UpdateFailed (msg )
8283
84+ # check for null or zero value in the data & skip further processing
85+ # of this update if one is found. this is a normal condition
86+ # indicating that there is no protection window.
87+ if not data [key ]:
88+ LOGGER .warning ("Skipping update due to missing data: %s" , key )
89+ return {}
90+
8391 data = self ._parse_data (data )
8492 data = self ._process_data (data )
8593
You can’t perform that action at this time.
0 commit comments