vectronic / homebridge-shinobi

A Homebridge plugin integrating Shinobi for motion detector cameras

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

SyntaxError: "[object Object]" is not valid JSON

rschitz opened this issue · comments

after a shinobi update, cameras apeared disconnected in homekit and got this error for each cam:

[5/24/2024, 10:37:39 PM] [homebridge-shinobi] found existing accessory for UUID: 533af1f9-38d0-4425-93c3-17edd6606d25 => ScCJQVfZ5p monitor
[5/24/2024, 10:37:39 PM] [homebridge-shinobi] creating ShinobiStreamingDelegate using shinobi config: {"ke":"wWwPjTn8W9","mid":"ScCJQVfZ5p","name":"yi-1059","details":{"max_keep_days":"","notes":"","dir":"","auto_compress_videos":"","geolocation":"49.04752881965128,2.014017119641565,9,90,60,1","rtmp_key":"","auto_host_enable":"1","auto_host":"","rtsp_transport":"tcp","muser":"","mpass":"","port_force":"0","fatal_max":"0","skip_ping":"","is_onvif":"","onvif_port":"","primary_input":"0","aduration":"1000000","probesize":"1000000","stream_loop":"0","sfps":"","wall_clock_timestamp_ignore":"","accelerator":"0","hwaccel":"auto","hwaccel_vcodec":"","hwaccel_device":"","stream_type":"hls","stream_flv_type":"http","stream_flv_maxLatency":"","stream_mjpeg_clients":"","stream_vcodec":"copy","stream_acodec":"no","hls_time":"2","hls_list_size":"3","preset_stream":"ultrafast","stream_quality":"15","stream_fps":"2","stream_scale_x":"","stream_scale_y":"","stream_rotate":"","signal_check":"10","signal_check_log":"0","stream_vf":"","tv_channel":"0","tv_channel_id":"temp_0PoLg","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":"","snap_scale_y":"","snap_vf":"","vcodec":"copy","crf":"1","preset_record":"","acodec":"no","record_scale_y":"","record_scale_x":"","cutoff":"15","rotate":"","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":"","record_timelapse_fps":"300","record_timelapse_scale_x":"640","record_timelapse_scale_y":"360","record_timelapse_vf":"","record_timelapse_watermark":"","record_timelapse_watermark_location":"","record_timelapse_watermark_position":"","detector":"1","onvif_events":"0","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":"","detector_send_frames":"1","detector_fps":"","detector_scale_x":"640","detector_scale_y":"360","detector_lock_timeout":"","detector_send_video_length":"","snap_seconds_inward":"","cords":"{"Zone1":{"name":"Zone1","sensitivity":"60","max_sensitivity":"","threshold":"20","color_threshold":"40","points":[["130","110"],["130","326"],["419","321"],["414","128"]]}}","detector_filters":"{"aJJ7P":{"id":"aJJ7P","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":"1","detector_sensitivity":"","detector_max_sensitivity":"","detector_threshold":"1","detector_color_threshold":"","inverse_trigger":"","detector_frame":"0","detector_motion_tile_mode":null,"detector_tile_size":"","detector_noise_filter":"","detector_noise_filter_range":"","detector_use_detect_object":"0","detector_object_ignore_not_move":"","detector_object_move_percent":"","detector_send_frames_object":"","detector_obj_count_in_region":"","detector_obj_region":"","detector_use_motion":"1","detector_fps_object":"","detector_scale_x_object":"","detector_scale_y_object":"","detector_buffer_vcodec":"auto","detector_buffer_acodec":"","detector_buffer_fps":"","event_record_scale_x":"","event_record_scale_y":"","event_record_aduration":"","event_record_probesize":"","detector_audio":"","detector_audio_min_db":"","detector_audio_max_db":"","detector_webhook":"0","detector_webhook_timeout":"","detector_webhook_url":"","detector_webhook_method":"","detector_command_enable":"0","detector_command":"","detector_command_timeout":"","detector_notrigger":"0","detector_notrigger_timeout":"","detector_notrigger_discord":"","detector_notrigger_webhook":"","detector_notrigger_webhook_url":"","detector_notrigger_webhook_method":"","detector_notrigger_command_enable":"","detector_notrigger_command":"","detector_notrigger_command_timeout":"","control":"0","control_base_url":"","control_url_method":"ONVIF","onvif_non_standard":"1","control_digest_auth":"","control_axis_lock":"","control_stop":"1","control_url_stop_timeout":"500","control_turn_speed":"0.01","detector_ptz_follow":"0","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":"","notify_emailClient":"","notify_telegram":"1","notify_global_webhook":"","notify_onUnexpectedExit":"","notify_useRawSnapshot":"","detector_emailClient_timeout":"","detector_telegrambot_send_video":"","detector_telegrambot_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":""},"type":"h264","ext":"mp4","protocol":"","host":"","path":"","port":"","fps":1,"mode":"start","width":640,"height":480,"saveDir":null,"tags":"B2,Box","currentlyWatching":0,"status":"Watching","code":"2","subStreamActive":false,"snapshot":"/MHJIzULI1cL3S3Y95oyD3zlCra7fQZ/jpeg/wWwPjTn8W9/ScCJQVfZ5p/s.jpg","streams":["/MHJIzULI1cL3S3Y95oyD3zlCra7fQZ/hls/wWwPjTn8W9/ScCJQVfZ5p/s.m3u8"],"streamsSortedByType":{"hls":["/MHJIzULI1cL3S3Y95oyD3zlCra7fQZ/hls/wWwPjTn8W9/ScCJQVfZ5p/s.m3u8"]}}
[5/24/2024, 10:37:39 PM] [homebridge-shinobi] SyntaxError: "[object Object]" is not valid JSON
at JSON.parse ()
at new ShinobiStreamingDelegate (/var/lib/homebridge/node_modules/homebridge-shinobi/src/shinobiStreamingDelegate.ts:72:37)
at new ShinobiMonitorAccessory (/var/lib/homebridge/node_modules/homebridge-shinobi/src/shinobiMonitorAccessory.ts:60:41)
at ShinobiHomebridgePlatform.createMonitor (/var/lib/homebridge/node_modules/homebridge-shinobi/src/platform.ts:120:53)
at /var/lib/homebridge/node_modules/homebridge-shinobi/src/platform.ts:94:26
at processTicksAndRejections (node:internal/process/task_queues:95:5)
[5/24/2024, 10:37:39 PM] [homebridge-shinobi] didFinishLaunching() error: "[object Object]" is not valid JSON

double check everything (api keys, ip, ports, fqdn) nothing obvious, let me know if i can share any logs to help. Thanks

Hello,

I am afraid to say as per the message on the readme for this project that I no longer use this plugin nor intend to maintain it...

That said I had a quick look at the issue and there isn't actually much I can do. As per the error message, the "JSON" returned from Shinobi is no longer valid JSON... The issue starts at the cords property in the response from shinobi you provided...

<snip>
"cords":"{"Zone1":
</snip>

It looks like JSON has been embedded in JSON but it has not been properly escaped....

Sorry i didn't noticed, thanks for taking some time to help.
ok so i guess one of the update broke your plugin, i'll try to ask the shinobi dev then.
Thanks again and good luck for your next project!

commented

@vectronic could the project be transferred to me? I am the developer of Shinobi