Unifi Protect Person detection

Does the Protect integration actually detect a person and output an event in HA? I set up a notification automation that should notify my phone if a person is detected on my doorbell camera. I checked in my Protect app and the camera/ app is detecting people, but in my event logs in HA, it does not show any people detections. Is this a limitation of the HA integration or is there something else that needs to be configured in HA to actually get the state changes and/ or events to fire?

1 Like

I can confirm. My logs show motion detected and object detection cleared but not the actual object being detected.

From what I can tell, HA does not get the alert from Unifi. In Protect, I see people detections show up and are very reliable. I, I see no detections in HA logs. If I manually, set the status of the switch (switch.doorbell_detections_person) to “on”, I see the entity in node red change and the notification goes out, although the reaction time from when I change the state of the switch to when node shows the detection and when the notification is sent is between 30 seconds to 1 min. Not sure if the Protect integration just doesn’t send the event but it appears that HA never gets the state change for a person detection.

That’s odd. I know that it’s definitely possible to extract it. The HomeSeer plugin does it very reliably. I think this is a bug in how HA is pulling it.

I know that when Unifi Protect was a HACS integration I could get person detection events from HA and differentiate those from non-person detections. I even had alerts coming to my phone and watch based on these.

But this ability seems to have been lost recently, possibly when it became an official (non-HACS) integration. That’s a big loss of functionality if so.

Thats really strange - Has anyone any input on how to use the person detection from Unifi in Home assistant today? (Maybe some additional HAC integration?)
Can the detected object be used?

image

Looks like this might be working in Node-red

Just checked mine and the detected object sensor does change when it detects a person or vehicle. The state only stays for a couple of seconds after trigger though

Would you mind sharing the JSON of your person detection flow as shown in that screenshot? I’ve been trying to capture the event but don’t have it working quite right.

I found that image on Red-it and I am also working to create it myself (Using basic cells no programming)
@Holdestmade With a trigger node you should be able to hold it as long as you want just need the “person” to detect for 1 second

I worked on this last evening and it seems to work now, but I would like to get some input on how to optimize this? it takes some seconds before the light is triggered I don’t know why because I can see the “person” detection is quick ?

This is for Person detection on all my cameras turning on all lights outside if its dark!

[{"id":"e465fc9f48125013","type":"light-scheduler","z":"67a9058f.cc6aec","settings":"70fe705d.07f9d","events":"[{\"start\":{\"dow\":1,\"mod\":0},\"end\":{\"dow\":2,\"mod\":0}},{\"start\":{\"dow\":2,\"mod\":0},\"end\":{\"dow\":3,\"mod\":0}},{\"start\":{\"dow\":3,\"mod\":0},\"end\":{\"dow\":4,\"mod\":0}},{\"start\":{\"dow\":4,\"mod\":0},\"end\":{\"dow\":5,\"mod\":0}},{\"start\":{\"dow\":5,\"mod\":0},\"end\":{\"dow\":6,\"mod\":0}},{\"start\":{\"dow\":6,\"mod\":0},\"end\":{\"dow\":0,\"mod\":0}},{\"start\":{\"dow\":0,\"mod\":0},\"end\":{\"dow\":1,\"mod\":1320}}]","topic":"","name":"Night-Light","onPayload":"ON","onPayloadType":"str","offPayload":"OFF","offPayloadType":"str","onlyWhenDark":true,"scheduleRndMax":"","sunElevationThreshold":"0","sunShowElevationInStatus":true,"outputfreq":"output.statechange","x":830,"y":180,"wires":[["25c2057bbde744b5","325291bd6935ba4e"]]},{"id":"25c2057bbde744b5","type":"debug","z":"67a9058f.cc6aec","name":"","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"payload","statusType":"auto","x":1010,"y":120,"wires":[]},{"id":"70c4195a2357069b","type":"server-state-changed","z":"67a9058f.cc6aec","name":"Driveway detected object","server":"df865a.eb4569a8","version":1,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"sensor.g4_pro_driveway_detected_object","entityidfiltertype":"exact","outputinitially":false,"state_type":"str","haltifstate":"person","halt_if_type":"str","halt_if_compare":"is","outputs":2,"output_only_on_state_change":true,"for":"1","forType":"num","forUnits":"seconds","ignorePrevStateNull":false,"ignorePrevStateUnknown":false,"ignorePrevStateUnavailable":false,"ignoreCurrentStateUnknown":false,"ignoreCurrentStateUnavailable":false,"x":170,"y":120,"wires":[["ab193412ae120d19","e8aa34b703a133c4"],[]]},{"id":"b1300ba7cbf453dd","type":"server-state-changed","z":"67a9058f.cc6aec","name":"Door walkway detected object","server":"df865a.eb4569a8","version":1,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"sensor.g4_main_door_detected_object","entityidfiltertype":"exact","outputinitially":false,"state_type":"str","haltifstate":"person","halt_if_type":"str","halt_if_compare":"is","outputs":2,"output_only_on_state_change":true,"for":"1","forType":"num","forUnits":"seconds","ignorePrevStateNull":false,"ignorePrevStateUnknown":false,"ignorePrevStateUnavailable":false,"ignoreCurrentStateUnknown":false,"ignoreCurrentStateUnavailable":false,"x":180,"y":180,"wires":[["ab193412ae120d19","e8aa34b703a133c4"],[]]},{"id":"a17dcd37909efdba","type":"server-state-changed","z":"67a9058f.cc6aec","name":"Terrace detected object","server":"df865a.eb4569a8","version":1,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"sensor.g4_terrace_detected_object","entityidfiltertype":"exact","outputinitially":false,"state_type":"str","haltifstate":"person","halt_if_type":"str","halt_if_compare":"is","outputs":2,"output_only_on_state_change":true,"for":"1","forType":"num","forUnits":"seconds","ignorePrevStateNull":false,"ignorePrevStateUnknown":false,"ignorePrevStateUnavailable":false,"ignoreCurrentStateUnknown":false,"ignoreCurrentStateUnavailable":false,"x":160,"y":240,"wires":[["ab193412ae120d19","e8aa34b703a133c4"],[]]},{"id":"d977d633679e8c6d","type":"server-state-changed","z":"67a9058f.cc6aec","name":"Garden detected object","server":"df865a.eb4569a8","version":1,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"sensor.g4_garden_detected_object","entityidfiltertype":"exact","outputinitially":false,"state_type":"str","haltifstate":"person","halt_if_type":"str","halt_if_compare":"is","outputs":2,"output_only_on_state_change":true,"for":"1","forType":"num","forUnits":"seconds","ignorePrevStateNull":false,"ignorePrevStateUnknown":false,"ignorePrevStateUnavailable":false,"ignoreCurrentStateUnknown":false,"ignoreCurrentStateUnavailable":false,"x":160,"y":300,"wires":[["ab193412ae120d19","e8aa34b703a133c4"],[]]},{"id":"8252d849ce781344","type":"server-state-changed","z":"67a9058f.cc6aec","name":"Doorbell detected object","server":"df865a.eb4569a8","version":1,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"sensor.g4_doorbell_detected_object","entityidfiltertype":"exact","outputinitially":false,"state_type":"str","haltifstate":"person","halt_if_type":"str","halt_if_compare":"is","outputs":2,"output_only_on_state_change":true,"for":"1","forType":"num","forUnits":"seconds","ignorePrevStateNull":false,"ignorePrevStateUnknown":false,"ignorePrevStateUnavailable":false,"ignoreCurrentStateUnknown":false,"ignoreCurrentStateUnavailable":false,"x":170,"y":360,"wires":[["e8aa34b703a133c4","ab193412ae120d19"],[]]},{"id":"e8aa34b703a133c4","type":"debug","z":"67a9058f.cc6aec","name":"","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"payload","statusType":"auto","x":430,"y":260,"wires":[]},{"id":"ab193412ae120d19","type":"change","z":"67a9058f.cc6aec","name":"person to true","rules":[{"t":"change","p":"payload","pt":"msg","from":"none","fromt":"str","to":"false","tot":"bool"},{"t":"change","p":"payload","pt":"msg","from":"person","fromt":"str","to":"true","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":440,"y":200,"wires":[["c82548cee7d934f1","88fa6b9b47947a53"]]},{"id":"c238470174641bb5","type":"hue-group","z":"67a9058f.cc6aec","name":"Haven","bridge":"bee79edd7ce65cb0","groupid":"8","colornamer":false,"skipevents":false,"universalevents":false,"x":1330,"y":120,"wires":[[]]},{"id":"b8294b102692e05c","type":"hue-group","z":"67a9058f.cc6aec","name":"Udendørsbelysning","bridge":"bee79edd7ce65cb0","groupid":"13","colornamer":false,"skipevents":false,"universalevents":false,"x":1370,"y":180,"wires":[[]]},{"id":"19b3bf52c97a3602","type":"hue-group","z":"67a9058f.cc6aec","name":"Terrasse","bridge":"bee79edd7ce65cb0","groupid":"9","colornamer":false,"skipevents":false,"universalevents":false,"x":1340,"y":240,"wires":[[]]},{"id":"c82548cee7d934f1","type":"debug","z":"67a9058f.cc6aec","name":"","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"payload","statusType":"auto","x":610,"y":120,"wires":[]},{"id":"090b69704b4c73a6","type":"debug","z":"67a9058f.cc6aec","name":"","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"payload","statusType":"auto","x":1350,"y":300,"wires":[]},{"id":"88fa6b9b47947a53","type":"trigger","z":"67a9058f.cc6aec","name":"","op1":"light-only","op2":"OFF","op1type":"str","op2type":"str","duration":"10","extend":false,"overrideDelay":false,"units":"min","reset":"","bytopic":"all","topic":"topic","outputs":2,"x":630,"y":200,"wires":[["c4a31043635bb1b7","e465fc9f48125013"],["325291bd6935ba4e","1280e3cc5f86a2be"]]},{"id":"325291bd6935ba4e","type":"change","z":"67a9058f.cc6aec","name":"ON/OFF to true/false","rules":[{"t":"change","p":"payload","pt":"msg","from":"OFF","fromt":"str","to":"false","tot":"bool"},{"t":"change","p":"payload","pt":"msg","from":"ON","fromt":"str","to":"true","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":1080,"y":240,"wires":[["c238470174641bb5","b8294b102692e05c","19b3bf52c97a3602","090b69704b4c73a6"]]},{"id":"c4a31043635bb1b7","type":"debug","z":"67a9058f.cc6aec","name":"","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"payload","statusType":"auto","x":810,"y":120,"wires":[]},{"id":"b064d2e6e03595e6","type":"inject","z":"67a9058f.cc6aec","name":"off","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"OFF","payload":"OFF","payloadType":"str","x":910,"y":300,"wires":[["325291bd6935ba4e"]]},{"id":"1280e3cc5f86a2be","type":"debug","z":"67a9058f.cc6aec","name":"","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"payload","statusType":"auto","x":810,"y":360,"wires":[]},{"id":"8471810f3fcd5d5c","type":"inject","z":"67a9058f.cc6aec","name":"off","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"off","payload":"off","payloadType":"str","x":650,"y":260,"wires":[["e465fc9f48125013"]]},{"id":"f9f80b5179f9bcea","type":"inject","z":"67a9058f.cc6aec","name":"light-only","props":[{"p":"payload","v":"light-only","vt":"str"},{"p":"topic","v":"light-only","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"light-only","payload":"light-only","payloadType":"str","x":640,"y":300,"wires":[["e465fc9f48125013"]]},{"id":"70fe705d.07f9d","type":"light-scheduler-settings","name":"Alstedvej-8","latitude":"55.702407","longitude":"12.481258"},{"id":"df865a.eb4569a8","type":"server","name":"Home Assistant","legacy":false,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true},{"id":"bee79edd7ce65cb0","type":"hue-bridge","name":"Philips hue 2","bridge":"192.168.0.30","key":"fVz9zha75-7jwAs0t1lCaxbdlQMQHwow4Dxm8fDK","interval":"3000","disableupdates":false}]

I don’t use nodered, just use the detected object entity to trigger automations so only need a quick trigger

I would like to see how you did this using the built in Automation in HA?
Would you share a screen shot?

Sure:

- alias: Person Detected - Drive
  trigger:
    - platform: state
      entity_id: sensor.drive_camera_detected_object
      to: person
  action:
    - service: notify.mobile_app_phone
      data_template:
        message: "Person Detected on the Drive at {{now().strftime('%-I:%M %p')}}"
        title: Home Automation

- alias: Vehicle Detected - Drive
  trigger:
    - platform: state
      entity_id: sensor.drive_camera_detected_object
      to: vehicle
  action:
    - service: notify.mobile_app_phone
      data_template:
        message: "Vehicle Detected on the Drive at {{now().strftime('%-I:%M %p')}}"
        title: Home Automation
1 Like

Thanks! I actually think this works faster than the Node-red solution!

My only problem so far is that I just cant get the “Only when Dark” to work in the automation?


According to the guide this should work?

But for some reason the automation will not trigger if this condition is set?

Okay for anyone finding this I ended up changing it to:


This works “Only when dark”

You could also use the is_dark sensor in the camera itself, binary_sensor.XXXXX_is_dark is on when the infrared lights are on. It only works if the IR leds are set to come on at night in Protect

That is almost like having a LUX sensor! great idea!

I must admit that I like the automation UI and it works better than in Node-red (Seems faster)

My only complain is the delay timer in automation (I wanted the light to go off after 10 min) that was a very unstable count down. I ended up creating a input_boolean.outdoor_lights_on and two separate automations One to start and one to stop… or my skill level is just not good enough

I’m seeing the last 2 days UniFi Protect (the app) shows a detection, but HA doesn’t see it.

The camera is working and streams through HA fine though. Strange.

Nope. 20 charrrr.