mirror of
https://github.com/home-assistant/core.git
synced 2025-07-16 17:57:11 +00:00
Check explicitly for None value in Overkiz integration (#65045)
This commit is contained in:
parent
0a2f57e4f8
commit
65fb6f26f1
@ -48,7 +48,8 @@ class Awning(OverkizGenericCover):
|
|||||||
|
|
||||||
None is unknown, 0 is closed, 100 is fully open.
|
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 cast(int, current_position)
|
||||||
|
|
||||||
return None
|
return None
|
||||||
|
@ -51,9 +51,10 @@ class OverkizGenericCover(OverkizEntity, CoverEntity):
|
|||||||
|
|
||||||
None is unknown, 0 is closed, 100 is fully open.
|
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
|
OverkizState.CORE_SLATS_ORIENTATION, OverkizState.CORE_SLATE_ORIENTATION
|
||||||
):
|
)
|
||||||
|
if position is not None:
|
||||||
return 100 - cast(int, position)
|
return 100 - cast(int, position)
|
||||||
|
|
||||||
return None
|
return None
|
||||||
|
@ -79,8 +79,9 @@ class OverkizLight(OverkizEntity, LightEntity):
|
|||||||
@property
|
@property
|
||||||
def brightness(self) -> int | None:
|
def brightness(self) -> int | None:
|
||||||
"""Return the brightness of this light (0-255)."""
|
"""Return the brightness of this light (0-255)."""
|
||||||
if brightness := self.executor.select_state(OverkizState.CORE_LIGHT_INTENSITY):
|
value = self.executor.select_state(OverkizState.CORE_LIGHT_INTENSITY)
|
||||||
return round(cast(int, brightness) * 255 / 100)
|
if value is not None:
|
||||||
|
return round(cast(int, value) * 255 / 100)
|
||||||
|
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user