Fix double state write on camera added to hass when rtsp_to_webrtc is present (#93806)

This commit is contained in:
J. Nick Koston 2023-05-30 12:43:48 -05:00 committed by GitHub
parent 17d1c0733d
commit 89cc57c0d6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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.