Unifi Protect doesnt trigger a Homeassistant webhook on homeassistant.local

Hoping that someone could help me out.

I created an alarm rule in Unifi Protect, this alarm is triggered when a known face has been reconized. When it does it should trigger the webhook automation in Homeassistant.

But I cannot get it to work.

When triggering the automation by using the curl command it works flawless, the automation starts and the actions are being executed.

When a known face is beeing reconized the alarm rule in Unifi Protect detects it and send me an email.

So both worlds do what they should do.

The things is, my homeassistant is not secure for my local enivronment from the outside I use a certificate registered on my domain.

The domain from the outside is different then the one we use locally, locally I use the homeassistant.local domain.

So if I execute a curl command to the endpoint it will throw an exception

curl: (60) schannel: SNI or certificate check failed: SEC_E_WRONG_PRINCIPAL (0x80090322) - The target principal name is incorrect.

To fix this I just add -k to the curl command and the command is now ignoring the certificate error. This way the automation will be triggered.

From Unifi protect I cannot provide additional arguments to the post command. So I am assuming that when I do the same POST from Unifi Protect to HomeAssistant webhook that this is being blocked by the ssl exception.

Is there anyone that could help me out or point me in the right direction to get this working?

Post to an http endpoint?

Thats correct yes.

curl -k -X POST https://homeassistant.local:8123/api/webhook/the-webhook-trigger

been a while, still it doesn’t work.

A few tips I got from people:

  • Use HTTP instead of HTTPS
  • Use the IP-adress instead of the local domain name
  • In the alarm manager of Unifi Protect one set the WebHook dont do another action.

Still I cant get it to work, anybody that could help out?

I have a similar problem (using self signed certificates for my internal SSL/TLS configuration), and I had the same result - could get it to work with ‘curl -k’ from another host but otherwise it was failing because of SSL certs weren’t lining up. I tried creating my own ca-certificates.crt, but that didn’t work either because, apparently node uses it’s own ca-certs file, not the system one.

I don’t necessarily recommend this, but what is working for me is to edit the environment defaults on my UKCG2+ for protect, at /usr/share/unifi-protect/app/default and add

NODE_TLS_REJECT_UNAUTHORIZED=0

to that file, then restart protect.

Again - this turns off all TLS validation for that app, so watch your step. It may also be overwritten when the app is updated.

Cheers.

Oe almost forgot about this topic, here is an update.

I reached out to the Ubiquiti support desk about this issue, added a support ticket and they picked it up. After sharing a few log files, they start working on the issue and found the bug.

They told me that in the next Protect version the issue would be resolved.

So I’m waiting for this update and will test it again.

That’s Great! Thanks for doing the legwork on filling a report. Looking forward to the next release!

Do you still have the issue, on which version are you? Mine stopped working as from the latest update (am now on protect version 6.2.72)

Yes the webhook is still not working.

Protect version 6.2.72 installed.
Now in contact with unifi support for re-opening the ticket

Thanks, at least i know there is no need to look further. Thought it was a firewall issue at first.

Hi! I Have the same issue. Self-signed server, no way of communicating other way than curl -k. Unifi have also opened a ticket.

I recently let Unifi support re-open the ticket. They are still investigating the problem.

The more tickets are opened the better!

Just updated to the new version and can confirm in my case the webhooks are triggered succesfully again. Version is 6.2.83

Can you share your automation and some screenshots of the alarm manager?

My protect is on the same version but my webhook is not triggered.

Sure, See below the automation which triggers on a webhook (actually multiple webhooks linked to various people - but removed for simplicity), not the webhook is, this needs to be identical to the last part of the URL in unifi protect.
It then checks 2 conditions, 1-> one of two people needs to be in the home zone and 2-> time between 7.30 and 23.30, and as action it opens the nuki lock.

Also included the snippets from the alarm manager, note the Url, this needs to be set to post and is setup as follows : http://[homeassistant_ip]:[port]/api/webhook/[webhook-id]

Be sure everything can communicate when in different vlans and select the appropriate devices and activities.

Hope this helps!

alias: Fingerprint
description: ""
triggers:
  - trigger: webhook
    allowed_methods:
      - POST
      - PUT
    local_only: true
    webhook_id: fingerprint-Redacted
    alias: Finger print Ronald
conditions:
  - condition: or
    conditions:
      - condition: zone
        entity_id: person.person1
        zone: zone.home
      - condition: zone
        entity_id: person.person2
        zone: zone.home
  - condition: time
    after: "07:30:00"
    before: "23:30:00"
actions:
  - data: {}
    target:
      entity_id:
        - lock.front_door
    action: lock.open
mode: parallel
max: 3

Thanks.

In my case it still doesn’t work.

alias: webhook test
description: ""
triggers:
  - trigger: webhook
    allowed_methods:
      - POST
      - PUT
    local_only: true
    webhook_id: known_face
    alias: Recognize me!
conditions: []
actions:
  - action: notify.mobile_app_iphone
    metadata: {}
    data:
      message: activated
mode: parallel
max: 3

Created a very simple automation just to check if the trigger is working.
Created an alarm that is triggering when an unknown face or my own is being recognized

Both are in the same vlan and can communicate with each other.

weird. What if you try something even simpler? Doorbell press?

That rules out an issue with this specifc camera firmware

Good suggestion.

I created a new alarm:

Pushed the button on the backdoor bell

The alarm is triggerd as you can see:

Nothing happens in HomeAssistant.

Really odd. Mine has been stable, bit reluctant to install the most recent update though!

Just to rule out some firewall rule acting up, can you post to an external website? There are quite some online api testers.
Reverse is also something to test, perhaps try a curl to your home assistant triggering the webhook?

Posting a Curl command to the webhook in HA works perfect, did those test in an earlier stage to make sure both ends would work.

I do know that both ends work but they cannot connect to each other.