Add more logging for UniFi Protect event entities (#84575)

* Add more logging for UniFi Protect event entities

* Condense logging

* Linting
This commit is contained in:
Christopher Bailey 2022-12-26 14:07:40 -05:00 committed by GitHub
parent a70163042d
commit cf92d8c536
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -83,10 +83,22 @@ class ProtectEventMixin(ProtectRequiredKeysMixin[T]):
if value:
event = self.get_event_obj(obj)
value = event is not None
if not value:
_LOGGER.debug("%s (%s): missing event", self.name, obj.mac)
if event is not None and self.ufp_smart_type is not None:
value = self.ufp_smart_type in event.smart_detect_types
if not value:
_LOGGER.debug(
"%s (%s): %s not in %s",
self.name,
obj.mac,
self.ufp_smart_type,
event.smart_detect_types,
)
if value:
_LOGGER.debug("%s (%s): value is on", self.name, obj.mac)
return value