-
Notifications
You must be signed in to change notification settings - Fork 38
Open
Description
from synology_dsm import SynologyDSM as sdsm
from synology_dsm.api.surveillance_station import SynoSurveillanceStation
from getpass import getpass
class Camera:
api:SynoSurveillanceStation
id:int
def __init__(self, api:SynoSurveillanceStation, id:int):
self.api = api
self.id = id
@property
def current_frame(self):
self.api.capture_camera_image(self.id)
USERNAME = "admin"
PASSWORD = getpass(f"Password for \"{USERNAME}\" > ")
PORT = "5001"
def getapi(host:str) -> SynoSurveillanceStation:
return sdsm(
host,
PORT,
USERNAME,
PASSWORD,
verify_ssl=False,
use_https=True
).surveillance_station
syn01 = getapi("syn01")
syn02 = getapi("syn02")
lobby = Camera(syn01, 10)
corner = Camera(syn02, 23)
current = lobby.current_frame
print(type(current))This code results in the following error:
Traceback (most recent call last):
File "c:\Users\Perzan\Desktop\synology-test\test.py", line 39, in <module>
current = lobby.current_frame
File "c:\Users\Perzan\Desktop\synology-test\test.py", line 16, in current_frame
self.api.capture_camera_image(self.id)
File "C:\Users\Perzan\Desktop\synology-test\lib\site-packages\synology_dsm\api\surveillance_station\__init__.py", line 92, in capture_camera_image
return self._dsm.get(
File "C:\Users\Perzan\Desktop\synology-test\lib\site-packages\synology_dsm\synology_dsm.py", line 194, in get
return self._request("GET", api, method, params, **kwargs)
File "C:\Users\Perzan\Desktop\synology-test\lib\site-packages\synology_dsm\synology_dsm.py", line 260, in _request
raise SynologyDSMAPIErrorException(
synology_dsm.exceptions.SynologyDSMAPIErrorException: {'api': 'SYNO.SurveillanceStation.SnapShot', 'code': 400, 'reason': 'Execution failed', 'details': {'param1': '', 'param2': ''}}
I know that this probably doesn't have anything to do with this library since it is an SynologyDSMAPIErrorException, but I wasn't sure what to do from here. Am I using the wrong ID for each camera? When I logged into the interface in my browser, I saw the camera identifier followed by a hyphen and the name of the camera. I used those identifiers in this script.
Metadata
Metadata
Assignees
Labels
No labels