#Unifi G4 Doorbell Pro Automation

1 messages · Page 1 of 1 (latest)

pliant halo
#

Look, I know this has been done before, and there are tons of guides out there. But for some reason, I cannot seem to get this working.

My YAML

description: Unlock door when fingerprint is identified, then reset the sensor
triggers:
  - entity_id:
      - event.g4_doorbell_pro_fingerprint
    trigger: state
    attribute: event_type
    to:
      - identified
actions:
  - action: lock.unlock
    data: {}
    target:
      device_id: a3a4abc84f1075c20687d2048be4dcb4
  - delay: "00:00:10"
  - action: lock.lock
    data: {}
    target:
      device_id: a3a4abc84f1075c20687d2048be4dcb4
mode: single

The issue I seem to be running into is that the Fingerprint Sensor event gets set to Identified each time a authorized fingerprint is scanned. This however is never reset, causing all further automations to fail unless a unauthorized fingerprint is detected, resetting the sensor to not_identified.

Please let me know if I am being stupid and it should be done completely different. Any help in this would be greatly appreciated.

opaque dust
pliant halo
# opaque dust You are not being stupid. The solution is that you react to any state change of ...

But how would I reset the state of the fingerprint sensor to something not 'Identified' so that it will trigger each time there is an identified scan, even back to back

My updated YAML:

description: Unlock door when fingerprint is identified, then reset the sensor
triggers:
  - entity_id:
      - event.g4_doorbell_pro_fingerprint
    trigger: state
conditions:
  - condition: state
    entity_id: event.g4_doorbell_pro_fingerprint
    state:
      - identified
    attribute: event_type
actions:
  - action: lock.unlock
    data: {}
    target:
      device_id: a3a4abc84f1075c20687d2048be4dcb4
  - delay:
      hours: 0
      minutes: 0
      seconds: 30
      milliseconds: 0
  - action: lock.lock
    data: {}
    target:
      device_id: a3a4abc84f1075c20687d2048be4dcb4
mode: single
opaque dust
#

I gave you the link. This is back to back.

#

Why did you put the condition in the trigger? You need it in a condition section of automation

opaque dust
#

Your condition should be like this:

conditions:
  - condition: template
    value_template: |
      {{ trigger.to_state.attributes.event_type == 'identified'}}
#

then please read the rest of the topic where it is recommended to not trigger from unavailable

pliant halo
# opaque dust then please read the rest of the topic where it is recommended to not trigger fr...

Ahhh, so something like this;

description: Unlock door when fingerprint is identified, then reset the sensor
triggers:
  - entity_id:
      - event.g4_doorbell_pro_fingerprint
    trigger: state
    attribute: event_type
conditions:
  - condition: template
    value_template: |
      {{ 
      trigger.event.data.old_state.state != 'unavailable' and
      trigger.event.data.new_state is not none and
      trigger.to_state.attributes.event_type == 'identified'
      }}
actions:
  - action: lock.unlock
    data: {}
    target:
      device_id: a3a4abc84f1075c20687d2048be4dcb4
  - delay:
      hours: 0
      minutes: 0
      seconds: 30
      milliseconds: 0
  - action: lock.lock
    data: {}
    target:
      device_id: a3a4abc84f1075c20687d2048be4dcb4
mode: single
opaque dust
#

for example, yes. But for old state you can use the "not_from" feature of the state trigger.

pliant halo
# opaque dust for example, yes. But for old state you can use the "not_from" feature of the st...

I'm sorry, I dont know what I am missing, Something must be going over my head.

I have the conditional you put in and attempted to follow what your thread said, but I still cannot seem to get the desired result. I mean, just to test I created an automation with JUST the event trigger and the conditional to see if it would perform any task and when I test it, the trigger ONLY triggers when there is a change, not when the state is already 'Identified'.

#

Using the dev tools in order to fake an input

opaque dust
#

Your trigger is wrong. It has to be:

triggers:
  - entity_id:
      - event.g4_doorbell_pro_fingerprint
    trigger: state
#

Remove the attribute part.

#

You likely want an automation like this:

triggers:
  - entity_id:
      - event.g4_doorbell_pro_fingerprint
    trigger: state
    not_from:
      - unavailable
conditions:
  - condition: template
    value_template: |
      {{ trigger.to_state.attributes.event_type == 'identified' }}

I think it should work like this.

pliant halo
#

I must be crazy because I feel like I have created 5 automations with that code and it is refusing to work. Is there possibly a time delay before it is able to take another input?

I mean its a little impractical that someone will need to use the fingerprint reader twice in less than 5 seconds, but I feel like that shouldnt matter.

opaque dust
#

No, I don't think so. But you do have the delay 10 seconds in your automation, FYI.

opaque dust
#

For this demo, I have the IKEA Rodret button, that has event.xxx entity. On every press it sends the event. If I keep pressing the button slowly, it will send on events all the time.
When it comes to event, the time is the one that is changing and we want to capture that in our automation. So, trigger on state means trigger when event time or anything else changes and then we check as a subinfo, what is the event type that came with the time.

#

In my case, I was checking the on type and I got many many triggers in one second (because I pressed it many times...), and on the diagram and text you can see that result was true for my automation.

#

now, if I press the off button, the condition fails, which you can see on the left diagram how it goes into the X state.

#
  to_state:
    entity_id: event.rodretremote_action
    state: '2025-12-25T10:46:52.852+00:00'
    attributes:
      event_types:
        - 'on'
        - 'off'
        - brightness_move_up
        - brightness_move_down
        - brightness_stop
      event_type: 'off'
      icon: mdi:gesture-double-tap
      friendly_name: RodretRemote Action