Skip to content

Commit

Permalink
Fix #166: Add privacy mode control
Browse files Browse the repository at this point in the history
  • Loading branch information
pjrt committed Aug 26, 2021
1 parent 5197eca commit f428841
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/amcrest/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,5 +73,6 @@ class ApiWrapper(
Storage,
Nas,
Media,
PrivacyMode,
):
pass
30 changes: 30 additions & 0 deletions src/amcrest/privacy_mode.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, version 2 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# vim:sw=4:ts=4:et

from .http import Http

# This API is based on an undocumented API of Amcrest Cameras. This API may change without notice
class PrivacyMode(Http):
@property
def privacy_set(self, turn_on: bool) -> str:
"""
Params:
turn_on - True to enable privacy mode, false to disable
Turns on privacy mode on or off in the camera
"""
ret = self.command(f"configManager.cgi?action=setConfig&LeLensMask[0].Enable={turn_on}")
return ret.content.decode()

@property
def privacy_config(self) -> str:
ret = self.command(f"configManager.cgi?action=getConfig&name=LeLensMask")
return ret.content.decode()

0 comments on commit f428841

Please sign in to comment.