Good day. Completed a new install and had the following issues.
cd /config && python3 /var/lib/zmeventnotification/mlapi_dbuser.py -u mlapitest -p test123
so installed your previous pyzm, which I forked before and it works for zmevent but produces the same error for mlapi login
Code: Select all
root@d58573099cd9:~/pyzm# sudo -u www-data /var/lib/zmeventnotification/bin/zm_detect.py --config /etc/zm/objectconfig.yml --debug --eventid 2
11/16/21 21:05:08.424519 zmesdetect_m3[1758] DBG1 new_yaml.py:242->[config:init: the supplied config file exists -> '/etc/zm/objectconfig.yml']
11/16/21 21:05:08.497158 zmesdetect_m3[1758] DBG1 new_yaml.py:265->[config::init: default configuration built (no secrets or substitution vars replaced, yet!)]
11/16/21 21:05:08.497942 zmesdetect_m3[1758] DBG1 new_yaml.py:170->[config:zmes:proc: 39 built in default keys added to the 'base' config -> ['force_mpd', 'same_model_high_conf', 'skip_mons', 'force_live', 'sanitize_str', 'version', 'basic_user', 'basic_password', 'image_path', 'max_detection_size', 'delete_after_analyze', 'write_debug_image', 'write_image_to_zm', 'hass_enabled', 'hass_people', 'hass_notify', 'hass_cooldown', 'push_err_device', 'push_jpg', 'push_jpg_key', 'push_gif', 'push_gif_key', 'push_debug_device', 'push_cooldown', 'mqtt_topic', 'mqtt_broker', 'mqtt_port', 'tls_cert', 'tls_key', 'fp16_target', 'alpr_api_type', 'alpr_url', 'openalpr_recognize_vehicle', 'openalpr_country', 'openalpr_state', 'openalpr_min_confidence', 'smart_fs_thresh', 'frame_strategy', 'same_model_sequence_strategy']]
11/16/21 21:05:08.498236 zmesdetect_m3[1758] DBG1 new_yaml.py:114->[config:zmes:proc: substituting '{{variables}}' for the 'base' config keys]
11/16/21 21:05:08.499031 zmesdetect_m3[1758] DBG1 new_yaml.py:136->[config:zmes: successfully replaced 3 default sub vars in the base config -> ['yolo4_models', 'coral_models', 'base_data_path']]
11/16/21 21:05:08.499395 zmesdetect_m3[1758] DBG1 new_yaml.py:285->[config:zmes: the configured secrets file exists and is a file -> '/etc/zm/zm_secrets.yml']
11/16/21 21:05:08.499723 zmesdetect_m3[1758] DBG1 new_yaml.py:291->[config:zmes: starting '{[secrets]}' substitution]
11/16/21 21:05:08.505495 zmesdetect_m3[1758] DBG1 new_yaml.py:324->[config:zmes: successfully replaced 17 secrets in the base config -> ['PUSHOVER_USER', 'ML_PASSWORD', 'ZM_API_PORTAL', 'ML_USER', 'PUSHOVER_PASS', 'HA_SERVER', 'ZM_PORTAL', 'PUSHOVER_APP_TOKEN', 'ZM_USER', 'PUSHOVER_USER_KEY', 'ZM_PASSWORD', 'MQTT_PASSWORD', 'PLATEREC_ALPR_KEY', 'MQTT_USERNAME', 'PUSHOVER_ERR_TOKEN', 'mlapi_one_key', 'HA_TOKEN']]
11/16/21 21:05:08.50584 zmesdetect_m3[1758] DBG1 new_yaml.py:329->[config:zmes: there are 2 secrets configured that have no substitution candidates in the base config or the secrets file -> ['AWS_SECRET_ACCESS_KEY', 'AWS_ACCESS_KEY_ID']]
11/16/21 21:05:08.507332 zmesdetect_m3[1758] DBG1 new_yaml.py:358->[config:zmes: starting '{{variable}}' substitution]
11/16/21 21:05:08.511712 zmesdetect_m3[1758] DBG1 new_yaml.py:375->[config:zmes: successfully replaced 51 sub vars in the base config -> ['gpu_max_processes', 'tpu_object_framework', 'face_num_jitters', 'face_recog_dist_threshold', 'contained_area', 'object_detection_pattern', 'yolo4_object_config', 'save_unknown_faces_leeway_pixels', 'same_model_sequence_strategy', 'tpu_tf2_mobilenetv2', 'frame_set', 'alpr_detection_pattern', 'openalpr_cmdline_params', 'model_sequence', 'openalpr_cmdline_binary', 'face_model', 'tpu_min_confidence', 'tpu_object_labels', 'openalpr_cmdline_min_confidence', 'tpu_max_lock_wait', 'yolo4_object_processor', 'face_train_model', 'face_detection_framework', 'smart_fps_thresh', 'disable_locks', 'tpu_max_processes', 'yolo4_object_framework', 'tpu_efficientdet_lite3', 'face_upsample_times', 'gpu_max_lock_wait', 'cpu_max_processes', 'show_models', 'frame_strategy', 'tpu_object_weights_mobilenetv2', 'yolo4_object_weights', 'alpr_key', 'save_unknown_faces', 'face_detection_pattern', 'platerec_min_dscore', 'platerec_min_score', 'known_images_path', 'past_det_max_diff_area', 'tpu_object_weights_mobiledet', 'max_detection_size', 'match_past_detections', 'object_min_confidence', 'tpu_face_weights_mobilenetv2', 'cpu_max_lock_wait', 'unknown_images_path', 'platerec_stats', 'yolo4_object_labels']]
11/16/21 21:05:08.513301 zmesdetect_m3[1758] DBG1 new_yaml.py:187->[config:zmes:proc: Base config has been built, all properly configured {[secrets]} and {{vars}} have been replaced! Remember you must manually build per monitor overrode configurations]
11/16/21 21:05:08.513605 zmesdetect_m3[1758] DBG1 zm_detect.py:542->[perf:zmes: building the intial config took 0.089105 ]
11/16/21 21:05:08.514035 zmesdetect_m3[1758] DBG1 new_yaml.py:747->[zmes:api create: building ZM API Session]
11/16/21 21:05:08.518527 zmesdetect_m3[1758] DBG1 api.py:114->[api: SSL certificate verification disabled (encryption enabled, vulnerable to MITM attacks)]
11/16/21 21:05:08.519165 zmesdetect_m3[1758] DBG1 api.py:283->[api: no token found, trying user/pass for login]
11/16/21 21:05:08.589037 zmesdetect_m3[1758] DBG1 api.py:320->[api: detected API ver 2.0+, using token system]
11/16/21 21:05:08.58953 zmesdetect_m3[1758] DBG1 api.py:335->[api: access token expires on: 2021-11-16 23:05:08.589511 (7200s)]
11/16/21 21:05:08.5899 zmesdetect_m3[1758] DBG1 api.py:347->[api: refresh token expires on: 2021-11-17 21:05:08.589891 (86400s)]
11/16/21 21:05:08.603434 zmesdetect_m3[1758] DBG1 new_yaml.py:780->[zmes:api create: ZM API created]
11/16/21 21:05:08.831121 zmesdetect_m3[1758] DBG1 ZMLog:336->[------| FORKED NEO --- app->Hooks: 7.0.3 - pyzm: 1.0.3 - ES: 7.0.3 - OpenCV:4.5.4 |------]
11/16/21 21:05:08.831532 zmesdetect_m3[1758] DBG1 ZMLog:336->[zmes: Setting up signal handlers for log 'rotation' and log 'interrupt']
11/16/21 21:05:08.667982 zmesdetect_m3[1758] DBG1 zm_detect.py:654->[zmes: this is a 'PAST' (debugging?) event!]
11/16/21 21:05:08.832551 zmesdetect_m3[1758] DBG1 ZMLog:336->[|----------= Encrypted Route Name: 'mlapi_one' | Gateway URL: 'http://192.168.1.100:5003/api/v1' | Weight: 0 =----------|]
11/16/21 21:05:08.669418 zmesdetect_m3[1758] DBG1 zm_detect.py:103->[zmes:mlapi:login: No need to login, access token is valid for 473.60833048820496 sec]
11/16/21 21:05:08.795808 zmesdetect_m3[1758] DBG1 zm_detect.py:318->[
** Gateway URL: 'http://192.168.1.100:5003/api/v1/detect/object?type=object' using auth_header={'Authorization': 'Bearer eyJ0eXAiOiJKV1QiLCJhbGc......'}
**** params={'delete': True, 'response_format': 'zm_detect'}
****** JSON: stream: 2 - mid: 3 - reason: None - stream options: {'frame_strategy': 'first', 'frame_set': 'snapshot, alarm, snapshot', 'contig_frames_before_error': 2, 'delay_between_attempts': 2.143256, 'max_attempts': 3, 'delay_between_snapshots': 1, 'smart_fps_thresh': '5', 'save_frames': 'no', 'save_frames_dir': None, 'PAST_EVENT': True} - files: {}
]
11/16/21 21:05:08.834301 zmesdetect_m3[1758] DBG1 ZMLog:336->[Connected to ZoneMinder Logging system with user 'www-data' -> '/var/log/zm/zmesdetect_m3.log']
11/16/21 21:05:08.808108 zmesdetect_m3[1758] DBG1 zm_detect.py:365->[zmes:mlapi: error during post to mlapi host-> keys must be str, int, float, bool or None, not bytes]
11/16/21 21:05:08.810038 zmesdetect_m3[1758] DBG1 zm_detect.py:368->[traceback-> Traceback (most recent call last):
File "/var/lib/zmeventnotification/bin/zm_detect.py", line 328, in remote_detect
r = requests.post(
File "/usr/lib/python3/dist-packages/requests/api.py", line 116, in post
return request('post', url, data=data, json=json, **kwargs)
File "/usr/lib/python3/dist-packages/requests/api.py", line 60, in request
return session.request(method=method, url=url, **kwargs)
File "/usr/lib/python3/dist-packages/requests/sessions.py", line 519, in request
prep = self.prepare_request(req)
File "/usr/lib/python3/dist-packages/requests/sessions.py", line 452, in prepare_request
p.prepare(
File "/usr/lib/python3/dist-packages/requests/models.py", line 316, in prepare
self.prepare_body(data, files, json)
File "/usr/lib/python3/dist-packages/requests/models.py", line 466, in prepare_body
body = complexjson.dumps(json)
File "/usr/lib/python3.8/json/__init__.py", line 231, in dumps
return _default_encoder.encode(obj)
File "/usr/lib/python3.8/json/encoder.py", line 199, in encode
chunks = self.iterencode(o, _one_shot=True)
File "/usr/lib/python3.8/json/encoder.py", line 257, in iterencode
return _iterencode(o, 0)
TypeError: keys must be str, int, float, bool or None, not bytes
]
11/16/21 21:05:08.810698 zmesdetect_m3[1758] DBG1 zm_detect.py:765->[perf:zmes:mlapi: Monitor: sofia (3)->'Event': 2 mlapi detection took: 0.141558]
11/16/21 21:05:08.811555 zmesdetect_m3[1758] DBG1 zm_detect.py:1533->[zmes: no predictions returned from detections]
11/16/21 21:05:08.813199 zmesdetect_m3[1758] DBG1 zm_detect.py:1601->[perf:zmes:FINAL: 'Monitor': sofia (3)->'Event': 2 [PAST event] [total:0.390353] [detection:0.141558] [after core detection: 0.000822] ]
root@d58573099cd9:~/pyzm#