Skip to content

Commit

Permalink
Merge pull request #186 from pjrt/pjrt/privacy_mode
Browse files Browse the repository at this point in the history
Fix #166: Add privacy mode control
  • Loading branch information
flacjacket committed Sep 10, 2021
2 parents a763a5e + 78492a2 commit d0b562e
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/amcrest/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
from .system import System
from .user_management import UserManagement
from .video import Video
from .privacy_mode import PrivacyMode


class AmcrestCamera:
Expand Down Expand Up @@ -73,5 +74,6 @@ class ApiWrapper(
Storage,
Nas,
Media,
PrivacyMode,
):
pass
34 changes: 34 additions & 0 deletions src/amcrest/privacy_mode.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# 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):
def set_privacy(self, mode: bool) -> str:
"""
Params:
mode - 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={mode}"
)
return ret.content.decode()

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

0 comments on commit d0b562e

Please sign in to comment.