From 6cefd558d8f60ac434845b6e69629fd7a4c4bcfd Mon Sep 17 00:00:00 2001 From: Brian Egge Date: Sat, 21 Aug 2021 13:58:37 -0400 Subject: [PATCH] Set unique id to amcrest serial number (#54675) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Joakim Sørensen Co-authored-by: Franck Nijhof Co-authored-by: Sean Vig --- homeassistant/components/amcrest/camera.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/homeassistant/components/amcrest/camera.py b/homeassistant/components/amcrest/camera.py index 1478c658d18..ac89c865862 100644 --- a/homeassistant/components/amcrest/camera.py +++ b/homeassistant/components/amcrest/camera.py @@ -365,10 +365,14 @@ class AmcrestCam(Camera): self._brand = "unknown" if self._model is None: resp = self._api.device_type.strip() + _LOGGER.debug("Device_type=%s", resp) if resp.startswith("type="): self._model = resp.split("=")[-1] else: self._model = "unknown" + if self._attr_unique_id is None: + self._attr_unique_id = self._api.serial_number.strip() + _LOGGER.debug("Assigned unique_id=%s", self._attr_unique_id) self.is_streaming = self._get_video() self._is_recording = self._get_recording() self._motion_detection_enabled = self._get_motion_detection()