Set unique id to amcrest serial number (#54675)

Co-authored-by: Joakim Sørensen <hi@ludeeus.dev>
Co-authored-by: Franck Nijhof <frenck@frenck.nl>
Co-authored-by: Sean Vig <sean.v.775@gmail.com>
This commit is contained in:
Brian Egge 2021-08-21 13:58:37 -04:00 committed by GitHub
parent 4a6ca8a04e
commit 6cefd558d8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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()