From f13c00300f99cad947c19f06d1baf4f30e796f69 Mon Sep 17 00:00:00 2001 From: Pergola Fabio Date: Mon, 8 Jan 2024 14:43:04 +0100 Subject: [PATCH] send employee_id as payload for acs event --- hikvision-doorbell/src/mqtt.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/hikvision-doorbell/src/mqtt.py b/hikvision-doorbell/src/mqtt.py index afb23e3..bf2fae1 100644 --- a/hikvision-doorbell/src/mqtt.py +++ b/hikvision-doorbell/src/mqtt.py @@ -232,11 +232,15 @@ async def acs_alarm( logger.info("Access control event: {} found with event: {}", major_alarm.name, minor_alarm.name) match minor_alarm.name: case "MINOR_FACE_VERIFY_PASS": - logger.info("Minor control event: {} found on door {} with employee id: {}", minor_alarm.name, door_id, employee_id) - trigger = DeviceTriggerMetadata(name=f"ACS Face Employee {employee_id}", type=f"face_verify", subtype=f"employee_id_{employee_id}") + logger.debug("Minor control event: {} found on door {} with employee id: {}", minor_alarm.name, door_id, employee_id) + attributes = { + 'employee_id': employee_id, + } + trigger = DeviceTriggerMetadata(name=f"{major_alarm.name} {minor_alarm.name}", type=f"", subtype=f"{major_alarm.name} {minor_alarm.name}", payload=attributes) + self.handle_device_trigger(doorbell, trigger) + case _: + trigger = DeviceTriggerMetadata(name=f"{major_alarm.name} {minor_alarm.name}", type=f"", subtype=f"{major_alarm.name} {minor_alarm.name}") self.handle_device_trigger(doorbell, trigger) - trigger = DeviceTriggerMetadata(name=f"{major_alarm.name} {minor_alarm.name}", type=f"", subtype=f"{major_alarm.name} {minor_alarm.name}") - self.handle_device_trigger(doorbell, trigger) except: logger.warning("Received unknown Access control event with Major: {} Minor: {}", major, minor) return