Fix possible OpenUV exception due to missing data (#26958)

pull/27029/head
Aaron Bach 2019-09-27 18:03:15 -06:00 committed by Paulus Schoutsen
parent ac634d71f4
commit ce97c27a7f
1 changed files with 5 additions and 0 deletions

View File

@ -102,6 +102,11 @@ class OpenUvBinarySensor(OpenUvEntity, BinarySensorDevice):
if not data:
return
for key in ("from_time", "to_time", "from_uv", "to_uv"):
if not data.get(key):
_LOGGER.info("Skipping update due to missing data: %s", key)
return
if self._sensor_type == TYPE_PROTECTION_WINDOW:
self._state = (
parse_datetime(data["from_time"])