jakowenko / double-take

Unified UI and API for processing and training images for facial recognition.
https://hub.docker.com/r/jakowenko/double-take
MIT License
1.25k stars 99 forks source link

HA Companion App Notifications Not Working Correctly #152

Open Iceman248 opened 3 years ago

Iceman248 commented 3 years ago

Perhaps I'm doing it wrong, but copying the code and changing things to fit my setup, I get these notifications. I only changed what needed to be changed and I do receive notifications, but only ever get this with notifications like this.

image

jakowenko commented 3 years ago

What are your Frigate camera names called? Does the correct camera name show up on the Match tab on the UI?

What detector are you using?

Iceman248 commented 3 years ago

Main one trying to get working is called "front". Correct camera name does show. DeepStack.

jakowenko commented 3 years ago

Can you paste the value of the entities attributes? Also, what is the state value of it?

I've noticed DeepStack returns 0% a lot on misses, you may want a condition to not notify on that value or for the unknown entity. If you have the ability to use CompreFace, I would suggest that.

Iceman248 commented 3 years ago

If you mean "sensor.double_take_front", sure. State value 0 unless somebody seen, then it goes to 1, at least some of the time. I looked at the entity history.

Here are the attributes.

id: 1635975628.912291-rate3j duration: 0.51 timestamp: 2021-11-03T21:40:29.895Z attempts: 3 camera: front zones: misses: matches: unknown: name: unknown confidence: 0 match: false box: top: 113 left: 254 width: 22 height: 30 checks:

personCount: 0 friendly_name: double_take_front icon: mdi:camera

I removed unknown, but unsure how to not have HA notify on 0% matches. CompreFace doesn't have unRAID app in the Community Apps store. I hadn't seen much in the way of success getting it working properly by manually installing via Docker, but a number of failures. Hopefully someone makes a template for it someday. Is MachineBox better than DeepStack? That is an unRAID app.

jakowenko commented 3 years ago

Oh. I see what you are doing. You're using the camera entity to trigger the notification, and the state of that shows how many people were seen. The example in my README was based more about notifying for specific people. This is why you get one when it detects a person and goes to 1, then 30 seconds later when it resets you get notified of 0.

What is the end goal of your notification? I can try to help create a new one based around the specific camera. Basically type up what you'd like the notification to say and I'll help create the automation YAML for it.

Iceman248 commented 3 years ago

I see. I really just want to notify of trained people. Frigate tells me of people in general, so just to start with, a notification of it recognizing me, then I can adapt that to other people as they are trained will work. Thanks.

Iceman248 commented 3 years ago

I wasn't sure if my response might've been confusing, but I do still need help getting notifications setup of specific people. Once I know how to do it for myself, I can adapt to newly trained faces. Thanks.

jakowenko commented 3 years ago

I wasn't sure if my response might've been confusing, but I do still need help getting notifications setup of specific people. Once I know how to do it for myself, I can adapt to newly trained faces. Thanks.

The example in the README is for a specific person and the unknown entity. If you don't want to include the unknown entity, just remove that entity_id from the trigger section. If you want to include more people, just add their entities like the below.

trigger:
  - platform: state
    entity_id: sensor.double_take_david
  - platform: state
    entity_id: sensor.double_take_iceman
Iceman248 commented 3 years ago

Thanks, but that's what was giving me the error I posted above. I don't know to avoid using the camera entity to trigger the notification. I didn't even know I was doing that. I only added my phone to the end of "notify.mobile_app" so it was correct service, put my name in the sensor entity, adjusted port from 3000 to 3002 in the 4 places it was as I already was using 3000 for another app, so I gave DT 3002. I put my server IP instead of localhost just to avoid any potential connectivity issue. That is when I received the 0 and 1's error.

Iceman248 commented 1 year ago

Revisiting this as I wasn't using facial recognition until I got a camera in an area it would actually work well. I do use CompreFace now. I set the automation back up using the readme and adjusting to my name and the DT ports, this time instead of that gibberish notification, I get nothing at all.

HA shows the trigger triggered, although in orange instead of the usual blue, not sure what that means, but it gets to the template condition of {{ trigger.to_state.state != trigger.from_state.state }} and finds that false, so it doesn't notify me, tried it several times.