This repository has been archived by the owner on Mar 25, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add methods to start and stop detection (#14)
* Parse doorbell params * Add methods to start and stop detection * Support for Python 3.8 * Log unhandled parameters * Sort methods * Black * Version bump * Fix start/stop detection methods
- Loading branch information
Showing
5 changed files
with
120 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
"""Define the package version.""" | ||
__version__: str = "0.1.1" | ||
__version__: str = "0.1.2" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
import json | ||
import base64 | ||
from enum import Enum | ||
|
||
|
||
class ParamType(Enum): | ||
# from com.oceanwing.battery.cam.binder.model.CameraParams | ||
CHIME_STATE = 2015 | ||
DETECT_EXPOSURE = 2023 | ||
DETECT_MODE = 2004 | ||
DETECT_MOTION_SENSITIVE = 2005 | ||
DETECT_SCENARIO = 2028 | ||
DETECT_SWITCH = 2027 | ||
DETECT_ZONE = 2006 | ||
DOORBELL_AUDIO_RECODE = 2042 | ||
DOORBELL_BRIGHTNESS = 2032 | ||
DOORBELL_DISTORTION = 2033 | ||
DOORBELL_HDR = 2029 | ||
DOORBELL_IR_MODE = 2030 | ||
DOORBELL_LED_NIGHT_MODE = 2039 | ||
DOORBELL_MOTION_ADVANCE_OPTION = 2041 | ||
DOORBELL_MOTION_NOTIFICATION = 2035 | ||
DOORBELL_NOTIFICATION_JUMP_MODE = 2038 | ||
DOORBELL_NOTIFICATION_OPEN = 2036 | ||
DOORBELL_RECORD_QUALITY = 2034 | ||
DOORBELL_RING_RECORD = 2040 | ||
DOORBELL_SNOOZE_START_TIME = 2037 | ||
DOORBELL_VIDEO_QUALITY = 2031 | ||
NIGHT_VISUAL = 2002 | ||
OPEN_DEVICE = 2001 | ||
RINGING_VOLUME = 2022 | ||
SDCARD = 2010 | ||
UN_DETECT_ZONE = 2007 | ||
VOLUME = 2003 | ||
|
||
# Inferred from source | ||
SNOOZE_MODE = 1271 # The value is base64 encoded | ||
WATERMARK_MODE = 1214 # 1 - hide, 2 - show | ||
DEVICE_UPGRADE_NOW = 1134 | ||
CAMERA_UPGRADE_NOW = 1133 | ||
|
||
# Set only params? | ||
PUSH_MSG_MODE = 1252 # 0 to ??? | ||
|
||
def read_value(self, value): | ||
if value: | ||
if self is ParamType.SNOOZE_MODE: | ||
value = base64.b64decode(value, validate=True).decode() | ||
return json.loads(value) | ||
return None | ||
|
||
def write_value(self, value): | ||
value = json.dumps(value) | ||
if self is ParamType.SNOOZE_MODE: | ||
value = base64.b64encode(value.encode()).decode() | ||
return value |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters