Use assignment expressions 29 (#58713)

This commit is contained in:
Marc Mueller 2021-10-30 16:31:43 +02:00 committed by GitHub
parent 887d04be60
commit b1d49b3b66
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
15 changed files with 27 additions and 62 deletions

View file

@ -157,8 +157,7 @@ class OpenUvSensor(OpenUvEntity, SensorEntity):
self._attr_native_value = UV_LEVEL_LOW
elif self.entity_description.key == TYPE_MAX_UV_INDEX:
self._attr_native_value = data["uv_max"]
uv_max_time = parse_datetime(data["uv_max_time"])
if uv_max_time:
if uv_max_time := parse_datetime(data["uv_max_time"]):
self._attr_extra_state_attributes.update(
{ATTR_MAX_UV_TIME: as_local(uv_max_time)}
)