Cleanup camera after late PR review ()

Cleanup changes to camera from 
This commit is contained in:
uvjustin 2022-09-06 18:33:21 +08:00 committed by GitHub
parent e5ac50fc57
commit 34da463df0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 2 deletions
homeassistant/components/camera

View file

@ -893,10 +893,11 @@ async def websocket_update_prefs(
entity_id = changes.pop("entity_id")
try:
entity_prefs = await prefs.async_update(entity_id, **changes)
connection.send_result(msg["id"], entity_prefs)
except HomeAssistantError as ex:
_LOGGER.error("Error setting camera preferences: %s", ex)
connection.send_error(msg["id"], "update_failed", str(ex))
else:
connection.send_result(msg["id"], entity_prefs)
async def async_handle_snapshot_service(

View file

@ -68,7 +68,8 @@ class CameraPreferences:
) -> dict[str, bool | int]:
"""Update camera preferences.
Returns a dict with the preferences on success or a string on error.
Returns a dict with the preferences on success.
Raises HomeAssistantError on failure.
"""
if preload_stream is not UNDEFINED:
# Prefs already initialized.