ZoneMinder / zmeventnotification

Machine Learning powered Secure Websocket & MQTT based ZoneMinder event notification server
408 stars 128 forks source link

Error if import_zm_zones = yes #389

Closed connectnet closed 3 years ago

connectnet commented 3 years ago

Event Server version app:6.1.21, pyzm:0.3.46

Hooks version (if you are using Object Detection) app:6.1.21, pyzm:0.3.46

Are you using MLAPI? (Y/N) n

The version of ZoneMinder you are using: v1.34.23

(Bug)

If import_zm_zones = yes the follow error occurs. Same if only_triggered_zm_zones=yes


04/11/21 15:08:02 zmesdetect_m2[27265] INF ZMLog.py:225 [Setting up signal handler for logs]
04/11/21 15:08:02 zmesdetect_m2[27265] INF ZMLog.py:234 [Switching global logger to ZMLog]
04/11/21 15:08:02 zmesdetect_m2[27265] INF zm_detect.py:271 [---------| app:6.1.21, pyzm:0.3.46, ES:6.1.21 , OpenCV:4.5.2-dev|------------]
04/11/21 15:08:02 zmesdetect_m2[27265] DBG1 utils.py:410 [secret filename: /etc/zm/secrets.ini]
04/11/21 15:08:02 zmesdetect_m2[27265] DBG2 utils.py:383 [Secret token found in config: !ZM_PORTAL]
04/11/21 15:08:02 zmesdetect_m2[27265] DBG2 utils.py:383 [Secret token found in config: !ZM_USER]
04/11/21 15:08:02 zmesdetect_m2[27265] DBG2 utils.py:383 [Secret token found in config: !ZM_PASSWORD]
04/11/21 15:08:02 zmesdetect_m2[27265] DBG2 utils.py:383 [Secret token found in config: !ZM_API_PORTAL]
04/11/21 15:08:02 zmesdetect_m2[27265] DBG2 utils.py:383 [Secret token found in config: !ML_USER]
04/11/21 15:08:02 zmesdetect_m2[27265] DBG2 utils.py:383 [Secret token found in config: !ML_PASSWORD]
04/11/21 15:08:02 zmesdetect_m2[27265] DBG2 utils.py:383 [Secret token found in config: !PLATEREC_ALPR_KEY]
04/11/21 15:08:02 zmesdetect_m2[27265] DBG1 utils.py:445 [allowing self-signed certs to work...]
04/11/21 15:08:02 zmesdetect_m2[27265] DBG4 utils.py:455 [Now checking for monitor overrides]
04/11/21 15:08:02 zmesdetect_m2[27265] DBG4 utils.py:473 [[monitor-2] overrides key:match_past_detections with value:no]
04/11/21 15:08:02 zmesdetect_m2[27265] DBG4 utils.py:473 [[monitor-2] overrides key:wait with value:5]
04/11/21 15:08:02 zmesdetect_m2[27265] DBG4 utils.py:473 [[monitor-2] overrides key:object_detection_pattern with value:.*]
04/11/21 15:08:02 zmesdetect_m2[27265] DBG4 utils.py:473 [[monitor-2] overrides key:import_zm_zones with value:yes]
04/11/21 15:08:02 zmesdetect_m2[27265] DBG4 utils.py:473 [[monitor-2] overrides key:resize with value:no]
04/11/21 15:08:02 zmesdetect_m2[27265] DBG2 utils.py:491 [my_sequence is not a polygon, adding it as unknown string key]
04/11/21 15:08:02 zmesdetect_m2[27265] DBG2 utils.py:174 [import_zm_zones: match_reason=False and reason=None]
04/11/21 15:08:02 zmesdetect_m2[27265] DBG2 utils.py:177 [Getting ZM zones using http://127.0.0.1/zm/api/zones/forMonitor/2.json?username=xxx&password=yyy&user=xxx&pass=yyy]
04/11/21 15:08:02 zmesdetect_m2[27265] ERR utils.py:202 [HTTP Error in import_zm_zones:HTTP Error 404: Not Found]
04/11/21 15:08:02 zmesdetect_m2[27265] ERR utils.py:514 [Error parsing config:/etc/zm/objectconfig.ini]
04/11/21 15:08:02 zmesdetect_m2[27265] ERR utils.py:515 [Error was:HTTP Error 404: Not Found]
04/11/21 15:08:02 zmesdetect_m2[27265] FAT utils.py:516 [error: Traceback:Traceback (most recent call last):
  File "/usr/local/lib/python3.8/dist-packages/zmes_hook_helpers/utils.py", line 499, in process_config
    import_zm_zones(args.get('monitorid'), args.get('reason'))
  File "/usr/local/lib/python3.8/dist-packages/zmes_hook_helpers/utils.py", line 200, in import_zm_zones
    input_file = opener.open(url)
  File "/usr/lib/python3.8/urllib/request.py", line 531, in open
    response = meth(req, response)
  File "/usr/lib/python3.8/urllib/request.py", line 640, in http_response
    response = self.parent.error(
  File "/usr/lib/python3.8/urllib/request.py", line 569, in error
    return self._call_chain(*args)
  File "/usr/lib/python3.8/urllib/request.py", line 502, in _call_chain
    result = func(*args)
  File "/usr/lib/python3.8/urllib/request.py", line 649, in http_error_default
    raise HTTPError(req.full_url, code, msg, hdrs, fp)
urllib.error.HTTPError: HTTP Error 404: Not Found
]
pliablepixels commented 3 years ago
[Getting ZM zones using http://127.0.0.1/zm/api/zones/forMonitor/2.json?username=xxx&password=yyy&user=xxx&pass=yyy

Why is that API returning an error? Try it from your browser (replace 127.0.0.1 with your ZM ip and xxx and yyy with your username and password).

I'd also please request you to do some of your own debugging instead of creating an issue the moment an error occurs.

connectnet commented 3 years ago

There must be a problem between match_past_detections=yes and import_zm_zones=yes together in objectconfig.ini file. Its not possible for me to get it work together. If I remove import_zm_zones=yes I have to delete monitor-x-data.pkl file in /var/lib/zmeventnotification/images before the detection works again.

pliablepixels commented 3 years ago

Maybe, but you haven't answered my question above. Why are you getting a 404 for the zones API? I use both match_detections and import_zm_zones

04/11/21 15:08:02 zmesdetect_m2[27265] DBG2 utils.py:177 [Getting ZM zones using http://127.0.0.1/zm/api/zones/forMonitor/2.json?username=xxx&password=yyy&user=xxx&pass=yyy]
04/11/21 15:08:02 zmesdetect_m2[27265] ERR utils.py:202 [HTTP Error in import_zm_zones:HTTP Error 404: Not Found]

Debug that first. Try it in the browser, replace IP, replace password/username

connectnet commented 3 years ago

Yes you are right. After reading the docs and thinking and reading I found the issue. It was my fault because I have 3 cams and deleted the second one in zonminder and add one new. So I was confused with Monitor-2 and the "real" Monitor-ID 3. Now I reinstalled the mysql zm database and started from begin.