Help with Synology API in HA

Hello,

I’m trying to add my Camera in HA from my Synology NVR.
I’m able to view my camera but i want to add the possibility to enable or disable my Camera in NVR from HA.

Anyone already do this please ?
Have you an idea how i can set this ?

Thanks a lot,
Regards
Jérôme

Looks like you can do it with RESTful commands. Page 56 of the Synology Surveillance Station Web API document (pdf) has the details to enable and disable cameras based on ID number.

1 Like

Thanks for your response.

I’ve tested with Postman and I’m able to login then enable or disable Cameras.

In HA, my configuration is :

  • configuration.yaml
rest_command:
  loginsynopi:
    url: !secret synology_login_url
  enable_cams:
    url: !secret cameras_enable_url
  disable_cams:
    url: !secret cameras_disable_url
  • secret.yaml
synology_login_url: http://192.168.1.1:5000/webapi/auth.cgi?api=SYNO.API.Auth&method=Login&version=2&account=myuser&passwd=mypassword&session=SurveillanceStation
cameras_enable_url: http://192.168.1.1:5000/webapi/entry.cgi?api="SYNO.SurveillanceStation.Camera"&method="Enable"&version=9&idList="3,4"
cameras_disable_url: http://192.168.1.1:5000/webapi/entry.cgi?api="SYNO.SurveillanceStation.Camera"&method="Disable"&version=9&idList="3,4"

But unfornatly, when I call login then enable or disable command, nothing appends and there is no logs.

Any idea about that please ?

I’ve tested many things, but in HA it’s not working :frowning:
I’m unable to call syno api.

With debug mode on rest_command, i finally catch the error :smiley:

2020-06-09 23:48:25 DEBUG (MainThread) [homeassistant.components.rest_command] Success. Url: http://192.168.1.1:5000/webapi/entry.cgi?api=%22SYNO.SurveillanceStation.Camera%22&method=%22Enable%22&version=9&idList=%223,4%22. Status code: 200.

Status is 200 but api return an error 105 (unauthorized).

Synology API require double quoted api, method and idList, so I need to escape it ?