diff --git a/homeassistant/components/overkiz/cover_entities/awning.py b/homeassistant/components/overkiz/cover_entities/awning.py index bb5b0e52186..bbce2c985ed 100644 --- a/homeassistant/components/overkiz/cover_entities/awning.py +++ b/homeassistant/components/overkiz/cover_entities/awning.py @@ -48,7 +48,8 @@ class Awning(OverkizGenericCover): None is unknown, 0 is closed, 100 is fully open. """ - if current_position := self.executor.select_state(OverkizState.CORE_DEPLOYMENT): + current_position = self.executor.select_state(OverkizState.CORE_DEPLOYMENT) + if current_position is not None: return cast(int, current_position) return None diff --git a/homeassistant/components/overkiz/cover_entities/generic_cover.py b/homeassistant/components/overkiz/cover_entities/generic_cover.py index 476ed23ae4d..60484620df1 100644 --- a/homeassistant/components/overkiz/cover_entities/generic_cover.py +++ b/homeassistant/components/overkiz/cover_entities/generic_cover.py @@ -51,9 +51,10 @@ class OverkizGenericCover(OverkizEntity, CoverEntity): None is unknown, 0 is closed, 100 is fully open. """ - if position := self.executor.select_state( + position = self.executor.select_state( OverkizState.CORE_SLATS_ORIENTATION, OverkizState.CORE_SLATE_ORIENTATION - ): + ) + if position is not None: return 100 - cast(int, position) return None diff --git a/homeassistant/components/overkiz/light.py b/homeassistant/components/overkiz/light.py index 6075267b8e6..b640a184f58 100644 --- a/homeassistant/components/overkiz/light.py +++ b/homeassistant/components/overkiz/light.py @@ -79,8 +79,9 @@ class OverkizLight(OverkizEntity, LightEntity): @property def brightness(self) -> int | None: """Return the brightness of this light (0-255).""" - if brightness := self.executor.select_state(OverkizState.CORE_LIGHT_INTENSITY): - return round(cast(int, brightness) * 255 / 100) + value = self.executor.select_state(OverkizState.CORE_LIGHT_INTENSITY) + if value is not None: + return round(cast(int, value) * 255 / 100) return None