Christofo / sssAI

AI based motion detection for Synology Surveillance Station
38 stars 17 forks source link

Issue with DSM 7 #13

Closed fatbob01 closed 3 years ago

fatbob01 commented 3 years ago

Good morning,

After updating to DSM 7, sssAI is no longer working for me. I suspect a change in camera ID or a permission issue.

I can no longer access the following to find the camera ID:

Open browser and go to: http://:/webapi/auth.cgi?api=SYNO.API.Auth&method=Login&version=2&account=&passwd=&session=SurveillanceStation&format=cookie

In the same browser on the same tab open this page: http://<nasip):/webapi/entry.cgi?api=SYNO.SurveillanceStation.Camera&method=List&version=2

I get {"error":{"code":103},"success":false} and {"error":{"code":105},"success":false}

Thanks for your help!

Christofo commented 3 years ago

I haven't updated to DSM yet and won't for a bit so I don't have a way to test. Can you open a ticket with Synology and inquire about any changes to the Surveillance Station API?

fatbob01 commented 3 years ago

Basically sent me a link to their documentation...I'll close for now. Thanks

martinlindhe commented 3 years ago

Investigating the same issue here (DSM 7 broke working sssai setup). My cameras have NOT changed ID:s in the upgrade if that is of any help.

The issue instead seems to be that sssai fails to to store temporary files here

https://github.com/Christofo/sssAI/blob/f3855fe91bf7c099e57245bf2b58776ccc052bc6/app/main.py#L143-L145

08/25/2021 03:40:22 PM - DEBUG - http://nas:83 "POST /v1/vision/detection HTTP/1.1" 400 59                                            
08/25/2021 03:40:22 PM - DEBUG - Got result: {                                                                                        
  "success": false,                                                                                                                   
  "error": "invalid image file",                                                                                                      
  "duration": 0                                                                                                                       
}. Time: 0.016291004023514688s
tsheldon commented 3 years ago

I've got an update on this, and I'll try to work on a pull request, but not sure on timeframe.

Looks like in the auth request, "version=1" may have been deprecated in dsm 7. I get a failure if I curl that path with version=1, but if I update to "version=6" it succeeds and I get the login cookies. I believe that the version correlates with the major version of DSM, but in my experiments, only version=6 seems to work against dsm 7. (versions 1-5, 7 all fail with code 103)

martinlindhe commented 3 years ago

@tsheldon Please see the API document here https://global.download.synology.com/download/Document/Software/DeveloperGuide/Package/SurveillanceStation/All/enu/Surveillance_Station_Web_API.pdf

The version number simply needs to be increased per the API doc depending on what arguments you are using. In the case of sssAI, we use "account" (version 1+), "passwd" (version 1+) and "session" (version 1+).

https://github.com/Christofo/sssAI/blob/abb69a8d0d18075ffb5bdeda1e04e0825516207c/app/main.py#L69

martinlindhe commented 3 years ago

@tsheldon You are right tho! I can verify only "version=6" works with logging in on DSM 7 + SSS 8.2.9.

However I think we need someone on DSM6 to verify that the following URL would work to log in as well so we don't break DSM6 support. Maybe @Christofo could verify since he said earlier he stayed on DSM6 for now?

This is the exact URL I mean:

curl "http://my-nas:5000/webapi/auth.cgi?api=SYNO.API.Auth&method=Login&version=6&account=username&passwd=password&session=SurveillanceStation"
tsheldon commented 3 years ago

Yep, plan is to send a PR that moves the unique API versions (and a couple of things from open requests) to ENV with the current defaults so nothing breaks.

Christofo commented 3 years ago

I'm not using sssAI anymore for my camera detections.. but happy to try and help still. On DSM6 changing to "version=6" I receive the following:

{"error":{"code":407},"success":false}

EDIT: Disregard - my IP was blocked from some earlier failed attempts. using "version=6" returns this:

{"data":{"is_portal_port":false,"sid":"tyJ0M5usvvsTZpobX82eMc1fk7Wzri7Z0H7EVITS1hc7ejTQHjVhOWeouMYtHb5V0AfVLzPRDR0nbJeHJxyMfQ"},"success":true}

Appears to work.

tsheldon commented 3 years ago

So - out of curiosity, since you're the repo owner, what are you using for your camera detections now? :)

Christofo commented 3 years ago

I'm using Frigate in a docker container on my DS920+. I bought a USB Coral Accelerator and it works fantastic. IMO it is much better than deepstack. You can use something like Node-RED to trigger Surveillance Station. I've been meaning to write up a blog post on the whole setup.

Also, in the latest version of Surveillance Station you can use action rules to trigger a motion detection event. If you are set on using this script I created, I would definitely take advantage of that.

tsheldon commented 3 years ago

I, for one, look forward to the blog post ... though, not to derail the bug thread too far, but if you already have Frigate running, why also use SSS?