From 89cc57c0d6b0e395ee893fe886cef603513d13be Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Tue, 30 May 2023 12:43:48 -0500 Subject: [PATCH] Fix double state write on camera added to hass when rtsp_to_webrtc is present (#93806) --- homeassistant/components/camera/__init__.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/homeassistant/components/camera/__init__.py b/homeassistant/components/camera/__init__.py index c09586848df..b22e2996f7e 100644 --- a/homeassistant/components/camera/__init__.py +++ b/homeassistant/components/camera/__init__.py @@ -673,7 +673,10 @@ class Camera(Entity): async def async_internal_added_to_hass(self) -> None: """Run when entity about to be added to hass.""" await super().async_internal_added_to_hass() - await self.async_refresh_providers() + # Avoid calling async_refresh_providers() in here because it + # it will write state a second time since state is always + # written when an entity is added to hass. + self._rtsp_to_webrtc = await self._async_use_rtsp_to_webrtc() async def async_refresh_providers(self) -> None: """Determine if any of the registered providers are suitable for this entity.