elad-bar / ha-shinobi

Shinobi Video custom component for HA
53 stars 5 forks source link

Failed to load monitor data #70

Closed SamKr closed 2 months ago

SamKr commented 4 months ago

Getting a Failed to load monitor data error as well, but different from #65 I think. It shows the error for all my monitors, but it does show all details. It ends with Error: the JSON object must be str, bytes or bytearray, not dict, Line: 464.

Here's the full (redacted) error output. Note that this probably started after I updated Shinobi to the latest version (didn't find out until a while later), so might be that the json format changed?

2024-07-08 13:37:17.929 ERROR (MainThread) [custom_components.shinobi.managers.rest_api] Failed to load monitor data: {'ke': '---------------', 'mid': '---------------', 'name': '-------', 'details': {'max_keep_days': '7', 'notes': '', 'dir': '', 'auto_compress_videos': None, 'rtmp_key': '', 'auto_host_enable': '1', 'auto_host': 'http://-------:-------@--.--.--.--:8081', 'rtsp_transport': 'tcp', 'muser': '-------', 'mpass': '-------', 'port_force': '0', 'fatal_max': '0', 'skip_ping': None, 'is_onvif': None, 'onvif_non_standard': None, 'onvif_port': '', 'primary_input': '0:0', 'aduration': '1000000000', 'probesize': '1000000000', 'stream_loop': '0', 'sfps': '', 'wall_clock_timestamp_ignore': None, 'accelerator': '0', 'hwaccel': 'auto', 'hwaccel_vcodec': '', 'hwaccel_device': '', 'stream_type': 'hls', 'stream_flv_type': 'ws', 'stream_flv_maxLatency': '', 'stream_mjpeg_clients': '', 'stream_vcodec': 'libx264', 'stream_acodec': 'no', 'hls_time': '2', 'hls_list_size': '3', 'preset_stream': 'ultrafast', 'stream_quality': '15', 'stream_fps': '', 'stream_scale_x': '', 'stream_scale_y': '', 'stream_rotate': None, 'signal_check': '10', 'signal_check_log': '0', 'stream_vf': '', 'tv_channel': '0', 'tv_channel_id': 'temp_lWr4r', 'tv_channel_group_title': '', 'stream_timestamp': '0', 'stream_timestamp_font': '', 'stream_timestamp_font_size': '', 'stream_timestamp_color': '', 'stream_timestamp_box_color': '', 'stream_timestamp_x': '', 'stream_timestamp_y': '', 'stream_watermark': '0', 'stream_watermark_location': '', 'stream_watermark_position': 'tr', 'snap': '1', 'snap_fps': '', 'snap_scale_x': '640', 'snap_scale_y': '480', 'snap_vf': '', 'vcodec': 'libx264', 'crf': '1', 'preset_record': '', 'acodec': 'no', 'record_scale_y': '640', 'record_scale_x': '480', 'cutoff': '15', 'rotate': None, 'vf': '', 'timestamp': '0', 'timestamp_font': '', 'timestamp_font_size': '10', 'timestamp_color': 'white', 'timestamp_box_color': '0x00000000@1', 'timestamp_x': '(w-tw)/2', 'timestamp_y': '0', 'watermark': '0', 'watermark_location': '', 'watermark_position': 'tr', 'record_timelapse': '1', 'record_timelapse_mp4': None, 'record_timelapse_fps': '6', 'record_timelapse_scale_x': '640', 'record_timelapse_scale_y': '480', 'record_timelapse_vf': '', 'record_timelapse_watermark': None, 'record_timelapse_watermark_location': '', 'record_timelapse_watermark_position': None, 'detector': '0', 'onvif_events': None, 'detector_save': '1', 'use_detector_filters': '0', 'use_detector_filters_object': '1', 'detector_record_method': 'sip', 'detector_trigger': '1', 'detector_buffer_seconds_before': '', 'detector_timeout': '0.5', 'watchdog_reset': '1', 'detector_delete_motionless_videos': '0', 'det_trigger_tags': '', 'detector_http_api': None, 'detector_send_frames': '1', 'detector_fps': '', 'detector_scale_x': '640', 'detector_scale_y': '480', 'detector_lock_timeout': '', 'detector_send_video_length': '', 'snap_seconds_inward': '', 'cords': '[]', 'detector_filters': '{"gQTeI":{"id":"gQTeI","enabled":"1","filter_name":"Standard Object Detection Filter","where":[{"p1":"tag","p2":"!indexOf","p3":"person","p4":"&&"},{"p1":"tag","p2":"!indexOf","p3":"car","p4":"&&"},{"p1":"tag","p2":"!indexOf","p3":"truck","p4":"&&"}],"actions":{"halt":"1","save":"","indifference":"","webhook":"","command":"","record":"","emailClient":"","global_webhook":""}}}', 'detector_pam': '1', 'detector_sensitivity': '', 'detector_max_sensitivity': '', 'detector_threshold': '1', 'detector_color_threshold': '', 'inverse_trigger': None, 'detector_frame': '0', 'detector_motion_tile_mode': None, 'detector_tile_size': '', 'detector_noise_filter': None, 'detector_noise_filter_range': '', 'detector_use_detect_object': '0', 'detector_send_frames_object': None, 'detector_obj_count_in_region': None, 'detector_obj_region': None, 'detector_use_motion': '1', 'detector_fps_object': '', 'detector_scale_x_object': '', 'detector_scale_y_object': '', 'detector_buffer_vcodec': 'libx264', 'detector_buffer_acodec': 'no', 'detector_buffer_fps': '', 'event_record_scale_x': '', 'event_record_scale_y': '', 'event_record_aduration': '', 'event_record_probesize': '', 'detector_audio': None, 'detector_audio_min_db': '', 'detector_audio_max_db': '', 'detector_webhook': '0', 'detector_webhook_timeout': '', 'detector_webhook_url': '', 'detector_webhook_method': None, 'detector_command_enable': '0', 'detector_command': '', 'detector_command_timeout': '', 'detector_notrigger': '0', 'detector_notrigger_timeout': '', 'detector_notrigger_discord': None, 'detector_notrigger_webhook': None, 'detector_notrigger_webhook_url': '', 'detector_notrigger_webhook_method': None, 'detector_notrigger_command_enable': None, 'detector_notrigger_command': '', 'detector_notrigger_command_timeout': '', 'control': '0', 'control_base_url': '', 'control_url_method': None, 'control_digest_auth': None, 'control_stop': '0', 'control_url_stop_timeout': '', 'control_turn_speed': '', 'detector_ptz_follow': None, 'detector_ptz_follow_target': '', 'control_url_center': '', 'control_url_left': '', 'control_url_left_stop': '', 'control_url_right': '', 'control_url_right_stop': '', 'control_url_up': '', 'control_url_up_stop': '', 'control_url_down': '', 'control_url_down_stop': '', 'control_url_enable_nv': '', 'control_url_disable_nv': '', 'control_url_zoom_out': '', 'control_url_zoom_out_stop': '', 'control_url_zoom_in': '', 'control_url_zoom_in_stop': '', 'control_invert_y': None, 'groups': '', 'notify_emailClient': None, 'notify_global_webhook': None, 'notify_onUnexpectedExit': None, 'notify_useRawSnapshot': None, 'detector_emailClient_timeout': '', 'cust_input': '', 'cust_stream': '', 'cust_snap': '', 'cust_snap_raw': '', 'cust_record': '', 'cust_detect': '', 'cust_detect_object': '', 'cust_sip_record': '', 'custom_output': '', 'loglevel': 'warning', 'sqllog': '0', 'detector_cascades': '', 'stream_channels': '', 'input_maps': '', 'input_map_choices': {'stream': [], 'snap': [], 'record': [], 'record_timelapse': [], 'detector': [], 'detector_object': [], 'detector_sip_buffer': []}, 'substream': {'input': {'type': 'h264', 'stream_flv_type': None, 'fulladdress': '', 'sfps': '', 'aduration': '', 'probesize': '', 'stream_loop': None, 'rtsp_transport': '', 'accelerator': '0', 'hwaccel': None, 'hwaccel_vcodec': '', 'hwaccel_device': '', 'cust_input': ''}, 'output': {'stream_type': 'hls', 'stream_mjpeg_clients': '', 'stream_vcodec': 'copy', 'stream_acodec': 'no', 'hls_time': '', 'hls_list_size': '', 'preset_stream': '', 'stream_quality': '', 'stream_v_br': '', 'stream_a_br': '', 'stream_fps': '', 'stream_scale_x': '640', 'stream_scale_y': '480', 'stream_rotate': None, 'svf': '', 'cust_stream': ''}}}, 'type': 'mjpeg', 'ext': 'mp4', 'protocol': 'http', 'host': '--.--.--.--', 'path': '/', 'port': 8081, 'fps': None, 'mode': 'record', 'width': 640, 'height': 480, 'saveDir': None, 'tags': '-------', 'currentlyWatching': 0, 'status': 'Died', 'code': '7', 'subStreamActive': False, 'snapshot': '/---------------------/jpeg/---------------/---------------/s.jpg', 'streams': ['/---------------------/hls/---------------/---------------/s.m3u8'], 'streamsSortedByType': {'hls': ['/---------------------/hls/---------------/---------------/s.m3u8']}}, Error: the JSON object must be str, bytes or bytearray, not dict, Line: 464

elad-bar commented 4 months ago

which docker image or repo & branch are you using for Shinobi Video server?

thanks

SamKr commented 4 months ago

I've used this guide to install on a Ubuntu 22.04.02 VM, a year or two ago. Last year I used this script to update to V3. Afterwards I've used the /super backend to update from time to time.

elad-bar commented 4 months ago

great, just to make sure, you have just upgraded to latest Shinobi sevrer and the issue began, is that correct?

thanks

SamKr commented 4 months ago

The latest version at the time, which is about 2 months ago. I updated to the current latest version to make sure, and reinstalled ha-shinobi as well. No change.

If it should work with the latest Shinobi server version, I have no problem rebuilding a new server using docker. But if it's an easy fix on your end, or more people (could) experience this problem; a fix would be great of course :)

Thanks for your time!

elad-bar commented 4 months ago

What do you mean build docker? You are creating your own flavor of docker image?

SamKr commented 4 months ago

No sorry, I mean just dropping the vm I currently use and deploy a new server using the docker guide (easier than setting up a new vm).

elad-bar commented 4 months ago

I stopped using docker over 4 months ago (switched to proxmox lxc container), so i'm not sure what is the issue, Will need to investigate it, most probably over the next weekend

Thanks for all the details

elad-bar commented 4 months ago

i checked with the latest version from master (main / default branch), it works without any issue, i think i can release a fix for it anyway, but cannot test it as in my system details are string while in your system it is dictionary, will let you know when the fix is ready

SamKr commented 4 months ago

Sounds good, thanks for making time to look into this, much appreciated :)

mcr-ksh commented 3 months ago

I can confirm to have the same problem. Shinobi (latest, commit b552d920fa8f458ab5b3211b1dbd99ded3feb025), ha plugin 3.0.10: 2024-08-06 11:00:16.202 ERROR (MainThread) [custom_components.shinobi.managers.rest_api] Failed to load monitor data: {'mid': 'Omb1OiipqE', 'ke': 'MmtVB6dacr', 'name': 'Living room', 'shto': '[]', 'shfr': '[]', 'details': {'max_keep_days': '', 'notes': '', 'dir': '', 'auto_compress_videos': None, 'geolocation': '', 'rtmp_key': '', 'auto_host_enable': '1', 'auto_host': 'rtsp://192.168.x.y:554/live0', 'rtsp_transport': 'tcp', 'muser': '', 'mpass': '', 'port_force': '0', 'fatal_max': '0', 'skip_ping': '1', 'is_onvif': None, 'onvif_non_standard': None, 'onvif_port': '', 'primary_input': '0:0', 'aduration': '1000000', 'probesize': '1000000', 'stream_loop': '0', 'sfps': '', 'wall_clock_timestamp_ignore': None, 'accelerator': '0', 'hwaccel': 'auto', 'hwaccel_vcodec': '', 'hwaccel_device': '', 'stream_type': 'hls', 'stream_flv_type': 'ws', 'stream_flv_maxLatency': '', 'stream_mjpeg_clients': '', 'stream_vcodec': 'copy', 'stream_acodec': 'copy', 'hls_time': '2', 'hls_list_size': '3', 'preset_stream': 'ultrafast', 'stream_quality': '15', 'stream_fps': '', 'stream_scale_x': '', 'stream_scale_y': '', 'stream_rotate': None, 'signal_check': '10', 'signal_check_log': '0', 'stream_vf': '', 'tv_channel': '0', 'tv_channel_id': 'temp_J3Qs8', 'tv_channel_group_title': '', 'stream_timestamp': '0', 'stream_timestamp_font': '', 'stream_timestamp_font_size': '', 'stream_timestamp_color': '', 'stream_timestamp_box_color': '', 'stream_timestamp_x': '', 'stream_timestamp_y': '', 'stream_watermark': '0', 'stream_watermark_location': '', 'stream_watermark_position': 'tr', 'snap': '1', 'snap_fps': '10', 'snap_scale_x': '', 'snap_scale_y': '', 'snap_vf': '', 'vcodec': 'copy', 'crf': '1', 'preset_record': '', 'acodec': 'copy', 'record_scale_y': '', 'record_scale_x': '', 'cutoff': '15', 'rotate': None, 'vf': '', 'timestamp': '0', 'timestamp_font': '', 'timestamp_font_size': '10', 'timestamp_color': 'white', 'timestamp_box_color': '0x00000000@1', 'timestamp_x': '(w-tw)/2', 'timestamp_y': '0', 'watermark': '0', 'watermark_location': '', 'watermark_position': 'tr', 'record_timelapse': '1', 'record_timelapse_mp4': None, 'record_timelapse_fps': '300', 'record_timelapse_scale_x': '', 'record_timelapse_scale_y': '', 'record_timelapse_vf': '', 'record_timelapse_watermark': None, 'record_timelapse_watermark_location': '', 'record_timelapse_watermark_position': None, 'detector': '0', 'onvif_events': None, 'detector_save': '1', 'use_detector_filters': '0', 'use_detector_filters_object': '1', 'detector_record_method': 'sip', 'detector_trigger': '1', 'detector_buffer_seconds_before': '', 'detector_timeout': '0.5', 'watchdog_reset': '1', 'detector_delete_motionless_videos': '0', 'det_trigger_tags': '', 'detector_http_api': None, 'detector_send_frames': '1', 'detector_fps': '', 'detector_scale_x': '640', 'detector_scale_y': '480', 'detector_lock_timeout': '', 'detector_send_video_length': '', 'snap_seconds_inward': '', 'cords': '[]', 'detector_filters': '{"HDOCJ":{"id":"HDOCJ","enabled":"1","filter_name":"Standard Object Detection Filter","where":[{"p1":"tag","p2":"!indexOf","p3":"person","p4":"&&"},{"p1":"tag","p2":"!indexOf","p3":"car","p4":"&&"},{"p1":"tag","p2":"!indexOf","p3":"truck","p4":"&&"}],"actions":{"halt":"1","save":"","indifference":"","webhook":"","command":"","record":"","emailClient":"","global_webhook":""}}}', 'detector_pam': '1', 'detector_motion_save_frame': None, 'detector_sensitivity': '', 'detector_max_sensitivity': '', 'detector_threshold': '1', 'detector_color_threshold': '', 'inverse_trigger': None, 'detector_frame': '0', 'detector_motion_tile_mode': None, 'detector_tile_size': '', 'detector_noise_filter': None, 'detector_noise_filter_range': '', 'detector_use_detect_object': '0', 'detector_object_ignore_not_move': None, 'detector_object_move_percent': '', 'detector_send_frames_object': None, 'detector_obj_count_in_region': None, 'detector_obj_region': None, 'detector_use_motion': '1', 'detector_fps_object': '', 'detector_scale_x_object': '', 'detector_scale_y_object': '', 'detector_buffer_vcodec': 'copy', 'detector_buffer_acodec': 'aac', 'detector_buffer_fps': '', 'event_record_scale_x': '', 'event_record_scale_y': '', 'event_record_aduration': '', 'event_record_probesize': '', 'detector_audio': None, 'detector_audio_min_db': '', 'detector_audio_max_db': '', 'detector_webhook': '0', 'detector_webhook_timeout': '', 'detector_webhook_url': '', 'detector_webhook_method': None, 'detector_command_enable': '0', 'detector_command': '', 'detector_command_timeout': '', 'detector_notrigger': '0', 'detector_notrigger_timeout': '', 'detector_notrigger_discord': None, 'detector_notrigger_webhook': None, 'detector_notrigger_webhook_url': '', 'detector_notrigger_webhook_method': None, 'detector_notrigger_command_enable': None, 'detector_notrigger_command': '', 'detector_notrigger_command_timeout': '', 'control': '0', 'control_base_url': '', 'control_url_method': None, 'control_digest_auth': None, 'control_stop': '0', 'control_url_stop_timeout': '', 'control_turn_speed': '', 'detector_ptz_follow': None, 'detector_ptz_follow_target': '', 'control_url_center': '', 'control_url_left': '', 'control_url_left_stop': '', 'control_url_right': '', 'control_url_right_stop': '', 'control_url_up': '', 'control_url_up_stop': '', 'control_url_down': '', 'control_url_down_stop': '', 'control_url_enable_nv': '', 'control_url_disable_nv': '', 'control_url_zoom_out': '', 'control_url_zoom_out_stop': '', 'control_url_zoom_in': '', 'control_url_zoom_in_stop': '', 'control_invert_y': None, 'notify_emailClient': None, 'notify_global_webhook': None, 'notify_onUnexpectedExit': None, 'notify_useRawSnapshot': None, 'detector_emailClient_timeout': '', 'cust_input': '', 'cust_stream': '', 'cust_snap': '', 'cust_snap_raw': '', 'cust_record': '', 'cust_detect': '', 'cust_detect_object': '', 'cust_sip_record': '', 'custom_output': '', 'loglevel': 'warning', 'sqllog': '0', 'detector_cascades': '', 'stream_channels': '', 'input_maps': '', 'input_map_choices': {'stream': [], 'snap': [], 'record': [], 'record_timelapse': [], 'detector': [], 'detector_object': [], 'detector_sip_buffer': []}, 'substream': {'input': {'type': 'h264', 'stream_flv_type': None, 'fulladdress': '', 'sfps': '', 'aduration': '', 'probesize': '', 'stream_loop': None, 'rtsp_transport': '', 'accelerator': '0', 'hwaccel': None, 'hwaccel_vcodec': '', 'hwaccel_device': '', 'cust_input': ''}, 'output': {'stream_type': 'hls', 'stream_mjpeg_clients': '', 'stream_vcodec': 'no', 'stream_acodec': '', 'hls_time': '', 'hls_list_size': '', 'preset_stream': '', 'stream_quality': '', 'stream_v_br': '', 'stream_a_br': '', 'stream_fps': '', 'stream_scale_x': '', 'stream_scale_y': '', 'stream_rotate': None, 'svf': '', 'cust_stream': ''}}}, 'type': 'h264', 'ext': 'mp4', 'protocol': 'rtsp', 'host': '192.168.x.y', 'path': '/live0', 'port': 554, 'fps': 1, 'mode': 'record', 'width': 640, 'height': 480, 'saveDir': '', 'tags': '', 'currentlyWatching': 0, 'status': 'Watching', 'code': '2', 'subStreamActive': False, 'snapshot': '/xxxx/jpeg/MmtVB6dacr/Omb1OiipqE/s.jpg', 'streams': ['/xxx/hls/MmtVB6dacr/Omb1OiipqE/s.m3u8'], 'streamsSortedByType': {'hls': ['/xxx/hls/MmtVB6dacr/Omb1OiipqE/s.m3u8']}}, Error: the JSON object must be str, bytes or bytearray, not dict, Line: 464

elad-bar commented 3 months ago

not sure why, I prepared a fix for it and didn't pushed it, will release v3.0.11 with a fix for it

elad-bar commented 3 months ago

released v3.0.11

mcr-ksh commented 3 months ago

I can confirm the monitors (cameras) are back and working!

SamKr commented 2 months ago

Sorry for the late reply, all good!

Thanks for taking the time to fix this @elad-bar, it's really appreciated :)

elad-bar commented 2 months ago

Great, thanks for updating 😀