Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug-fix for python3 #165

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -169,8 +169,8 @@ Surveillance Station usage
# Returns a list of cached cameras available
cameras = surveillance.get_all_cameras()

# Assuming there's at least one camera, get the first camera_id
camera_id = cameras[0].camera_id
# Assuming there's at least one camera, get the first camera id
camera_id = cameras[0].id

# Returns cached camera object by camera_id
camera = surveillance.get_camera(camera_id)
Expand Down
11 changes: 10 additions & 1 deletion src/synology_dsm/api/surveillance_station/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ class SynoSurveillanceStation:
CAMERA_EVENT_API_KEY = "SYNO.SurveillanceStation.Camera.Event"
HOME_MODE_API_KEY = "SYNO.SurveillanceStation.HomeMode"
SNAPSHOT_API_KEY = "SYNO.SurveillanceStation.SnapShot"
EXTEVENT_API_KEY = "SYNO.SurveillanceStation.ExternalEvent"

def __init__(self, dsm):
"""Initialize a Surveillance Station."""
Expand Down Expand Up @@ -55,7 +56,7 @@ def get_info(self):
# Camera
def get_all_cameras(self):
"""Return a list of cameras."""
return self._cameras_by_id.values()
return list(self._cameras_by_id.values())

def get_camera(self, camera_id):
"""Return camera matching camera_id."""
Expand Down Expand Up @@ -136,6 +137,14 @@ def disable_motion_detection(self, camera_id):
{"camId": camera_id, "source": MOTION_DETECTION_DISABLED},
)

def ext_event_trigger(self,eventId=1,event_message="event_message"):
"""Trigger external event"""
return self._dsm.get(
self.EXTEVENT_API_KEY,
"Trigger",
{"eventId": eventId, "eventName": event_message},
)

# Home mode
def get_home_mode_status(self):
"""Get the state of Home Mode."""
Expand Down