skrashevich/double-take

[BUG] Error and never sending MQTT message when face gets matched - "TypeError: MQTT: recognize error: Cannot read properties of undefined"

Closed this issue ยท 7 comments

Thanks a lot for your great work and taking up the ball :)

Describe the bug
After uploading a known face, it gets matched correctly. However after that, an error message is created and the MQTT message never seems to get sent:

Getting error:
error: TypeError: MQTT: recognize error: Cannot read properties of undefined (reading 'DEVICE_TRACKER_TIMEOUT')

Also the MQTT Topic does not get generated, alas this is expected, as it does not ever seem to send the MQTT message.

23-11-13 20:24:48 info: processing manual: a3f9755a-844d-4829-989a-a29e4a71f268
23-11-13 20:24:48 info: Access granted to IP address: ::ffff:127.0.0.1
23-11-13 20:24:48 info: Access granted to IP address: ::ffff:127.0.0.1
23-11-13 20:24:48 info: done processing manual: a3f9755a-844d-4829-989a-a29e4a71f268 in 0.23 sec
23-11-13 20:24:48 info: {
  id: 'a3f9755a-844d-4829-989a-a29e4a71f268',
  duration: 0.23,
  timestamp: '2023-11-13T19:24:48.445Z',
  attempts: 1,
  camera: 'manual',
  zones: [],
  counts: { person: 1, match: 1, miss: 0, unknown: 0 },
  matches: [
    {
      name: 'ufo',
      confidence: 100,
      match: true,
      box: [Object],
      type: 'manual',
      duration: 0.2,
      detector: 'aiserver',
      filename: 'ccaf237e-1df6-4a42-a299-1e1503ce402a.jpg'
    }
  ],
  misses: [],
  unknowns: []
}
23-11-13 20:24:48 error: TypeError: MQTT: recognize error: Cannot read properties of undefined (reading 'DEVICE_TRACKER_TIMEOUT')
    at /double-take/api/src/util/mqtt.util.js:280:29
    at Array.forEach (<anonymous>)
    at module.exports.recognize (/double-take/api/src/util/mqtt.util.js:239:13)
    at module.exports.start (/double-take/api/src/controllers/recognize.controller.js:185:10)
23-11-13 20:24:48 info: undefined
23-11-13 20:24:49 info: Access granted to IP address: ::ffff:172.30.32.2

Version of Double Take
v1.13.11.6.1 from 12th of november 2023

Expected behavior
After manually uploading a trained picture / known face via the UI, in case it gets recognised, an MQTT message is sent to the MQTT broker (and in this case a sensor in HA is created).

Screenshots
N/A

Hardware

  • Architecture or platform: [amd64]
  • OS: [Home Assistant OS - Linux]

Additional context
Detection is working well so far when manually uploading trained faces. Training is working well.

Please see config (took out comments here for clarity only):

# Double Take
mqtt:
  host: 192.168.128.235
  username: !secret mqtt_username
  password: !secret mqtt_password
  port: 1883
  client_id: double-take

  topics:
    homeassistant: homeassistant
    matches: double-take/matches
    cameras: double-take/cameras

detectors:
  aiserver:
    url: http://192.168.128.235:32168
    timeout: 15
    opencv_face_required: false

detect:
  match:
    save: true
    base64: false
    confidence: 60
    purge: 168
    min_area: 1000

  unknown:
    save: true
    base64: false
    confidence: 40
    purge: 8
    min_area: 0

Also, there is an old issue with the original double-take, but I found nothing there that would help me: jakowenko#169

try to add

frigate:
  device_tracker_timeout: 30

into config

Thanks a lot for the hint, that helped. Now the usecase of manually uploading is working so far :)
Without the frigate url set (I am not using frigate but BlueIris), the double-take icon stays red - is that a problem?

Do you have any plans to support additional NVRs like BlueIris? I would be happy to test. It can communicate via MQTT as well (and indeed does here).

Do you have any plans to support additional NVRs like BlueIris? I would be happy to test. It can communicate via MQTT as well (and indeed does here).

it's commercial NVR. I don't plan to support NVRs have only commercial licenses without open-source edition

OK, understood. Is there a planned way to use it without frigate? It would be great to have it automatically process images, when they are put into a directory - maybe I missed that, sorry, if so.

Regarding BlueIris, I just want to say that it is very, very, very reasonable priced and there is nothing else out there which is as good for small / medium home use, IMO. When I started with this, I tried several solutions (including frigate, but I had the wrong hardware, back then) and I am using it since many years. I am very glad that Ken is keeping it up. He is basically a one man show, AFAIK (having no ties or involvement other than being a fan).

Thanks again for your work and your help!

I will make it possible to use Double-Take without Frigate in the next release.

Hi, I am on v1.13.8.1.

I am still getting the above error. Attached are my config and logs.

Is my device_tracker_timeout in the right place under mqtt?

config.txt

double-take.log

It's because you use it without Frigate
As a workaround, you can add to the configuration

frigate:
  device_tracker_timeout: 30

The problem has already been fixed in the beta version, the fix will be included in release 1.13.11.9