From 34da463df02c2c9c9ee574ca9e7ef115395e6420 Mon Sep 17 00:00:00 2001 From: uvjustin <46082645+uvjustin@users.noreply.github.com> Date: Tue, 6 Sep 2022 18:33:21 +0800 Subject: [PATCH] Cleanup camera after late PR review (#77880) Cleanup changes to camera from #77439 --- homeassistant/components/camera/__init__.py | 3 ++- homeassistant/components/camera/prefs.py | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/homeassistant/components/camera/__init__.py b/homeassistant/components/camera/__init__.py index afc6be48144..e5ccb433975 100644 --- a/homeassistant/components/camera/__init__.py +++ b/homeassistant/components/camera/__init__.py @@ -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( diff --git a/homeassistant/components/camera/prefs.py b/homeassistant/components/camera/prefs.py index effc2f619bd..1107da2ba38 100644 --- a/homeassistant/components/camera/prefs.py +++ b/homeassistant/components/camera/prefs.py @@ -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.