Skip to content

Commit

Permalink
Add ability to adjust camera use as doorbell chime extender
Browse files Browse the repository at this point in the history
  • Loading branch information
natekspencer committed Mar 9, 2023
1 parent 5da4ba3 commit 869b399
Show file tree
Hide file tree
Showing 13 changed files with 7,965 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
- name: Run linting
run: |
poetry run isort .
poetry run black . --check
poetry run black . --check --extend-exclude proto
poetry run flake8 .
poetry run pylint vivintpy tests
poetry run pydocstyle vivintpy tests
Expand Down
160 changes: 159 additions & 1 deletion poetry.lock

Large diffs are not rendered by default.

1,769 changes: 1,769 additions & 0 deletions proto/vivintpy/proto/beam.proto

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion pylintrc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[MASTER]
#ignore=tests
ignore=proto
# Use a conservative default here; 2 should speed up most setups and not hurt
# any too bad. Override on command line as appropriate.
jobs=2
Expand Down
2 changes: 2 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ python = "^3.7.2"
aiohttp = "^3.8.4"
certifi = "^2022.9.24"
pubnub = "^7.0"
grpcio = "^1.51.3"

[tool.poetry.dev-dependencies]
tox = "^3.28.0"
Expand All @@ -27,6 +28,7 @@ isort = "^5.11.5"
mypy = "^1.0"
pydocstyle = "^6.3.0"
pylint = "^2.16.4"
grpcio-tools = "^1.51.3"

[build-system]
requires = ["poetry-core>=1.0.0"]
Expand Down
8 changes: 6 additions & 2 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[flake8]
exclude = .venv,.git,.tox,docs,venv,bin,lib,deps,build
exclude = .venv,.git,.tox,docs,venv,bin,lib,deps,build,proto
# To work with Black
max-line-length = 88
ignore =
Expand All @@ -14,6 +14,7 @@ include_trailing_comma = True
force_grid_wrap = 0
use_parentheses = True
line_length = 88
extend_skip_glob=vivintpy/proto/*

[mypy]
python_version = 3.9
Expand All @@ -30,5 +31,8 @@ warn_incomplete_stub = true
warn_redundant_casts = true
warn_unused_configs = true

[mypy-test.*,]
[mypy-vivintpy.proto.*]
ignore_errors = true

[pydocstyle]
match-dir = ^((?!proto).)*$
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ commands =
ignore_errors = True
commands =
poetry run isort .
poetry run black . --check
poetry run black . --check --extend-exclude proto
poetry run flake8 .
poetry run pylint vivintpy tests
poetry run pydocstyle vivintpy tests
Expand Down
1 change: 1 addition & 0 deletions vivintpy/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ class CameraAttribute(VivintDeviceAttribute):
CAMERA_DIRECT_AVAILABLE = "cda"
CAMERA_DIRECT_STREAM_PATH = "cdp"
CAMERA_DIRECT_STREAM_PATH_STANDARD = "cdps"
CAMERA_EXTEND_CHIME_ENABLED = "cex"
CAMERA_IP_ADDRESS = "caip"
CAMERA_IP_PORT = "cap"
CAMERA_MAC = "cmac"
Expand Down
11 changes: 11 additions & 0 deletions vivintpy/devices/camera.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,11 @@ def capture_clip_on_motion(self) -> bool:
"""Return True if capture clip on motion is active."""
return bool(self.data[Attribute.CAPTURE_CLIP_ON_MOTION])

@property
def extend_chime_enabled(self) -> bool:
"""Return True if used as doorbell chime extender."""
return self.data.get(Attribute.CAMERA_EXTEND_CHIME_ENABLED, False)

@property
def ip_address(self) -> str:
"""Camera's IP address."""
Expand Down Expand Up @@ -154,6 +159,12 @@ async def get_direct_rtsp_url(
else None
)

async def set_as_doorbell_chime_extender(self, state: bool) -> None:
"""Set camera's use as doorbell chime extender."""
await self.vivintskyapi.set_camera_as_doorbell_chime_extender(
self.alarm_panel.id, self.id, state
)

def handle_pubnub_message(self, message: dict) -> None:
"""Handle a pubnub message addressed to this camera."""
super().handle_pubnub_message(message)
Expand Down
536 changes: 536 additions & 0 deletions vivintpy/proto/beam_pb2.py

Large diffs are not rendered by default.

Loading

0 comments on commit 869b399

Please sign in to comment.