Improve type hints in camera (#81794)

pull/81852/head^2
epenet 2022-11-09 12:14:26 +01:00 committed by GitHub
parent b7f3eb77dc
commit 402bac5ed7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 4 deletions

View File

@ -859,8 +859,9 @@ async def websocket_get_prefs(
hass: HomeAssistant, connection: ActiveConnection, msg: dict[str, Any]
) -> None:
"""Handle request for account info."""
prefs = hass.data[DATA_CAMERA_PREFS].get(msg["entity_id"])
connection.send_result(msg["id"], prefs.as_dict())
prefs: CameraPreferences = hass.data[DATA_CAMERA_PREFS]
camera_prefs = prefs.get(msg["entity_id"])
connection.send_result(msg["id"], camera_prefs.as_dict())
@websocket_api.websocket_command(
@ -876,7 +877,7 @@ async def websocket_update_prefs(
hass: HomeAssistant, connection: ActiveConnection, msg: dict[str, Any]
) -> None:
"""Handle request for account info."""
prefs = hass.data[DATA_CAMERA_PREFS]
prefs: CameraPreferences = hass.data[DATA_CAMERA_PREFS]
changes = dict(msg)
changes.pop("id")
@ -955,7 +956,8 @@ async def _async_stream_endpoint_url(
)
# Update keepalive setting which manages idle shutdown
camera_prefs = hass.data[DATA_CAMERA_PREFS].get(camera.entity_id)
prefs: CameraPreferences = hass.data[DATA_CAMERA_PREFS]
camera_prefs = prefs.get(camera.entity_id)
stream.keepalive = camera_prefs.preload_stream
stream.orientation = camera_prefs.orientation