Skip to content

Commit

Permalink
Add Gen2 doorbell (#146)
Browse files Browse the repository at this point in the history
* Add gen2 doorbell support.

* Rename Arlo Essential doorbell.

* Bump revision.
  • Loading branch information
twrecked authored Mar 4, 2024
1 parent b4931b3 commit 72fd151
Show file tree
Hide file tree
Showing 7 changed files with 81 additions and 52 deletions.
4 changes: 4 additions & 0 deletions changelog
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
0.8.0.3
Add Arlo Essential XL support (thank @mzsanford)
Add Gen2 doorbell support.
Renamed Essential doorbell.
0.8.0.2
Handle 'synced' device state.
0.8.0.1
Expand Down
45 changes: 27 additions & 18 deletions pyaarlo/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@
MODEL_PRO_4,
MODEL_PRO_5,
MODEL_WIRED_VIDEO_DOORBELL,
MODEL_WIREFREE_VIDEO_DOORBELL,
MODEL_WIRED_VIDEO_DOORBELL2_HD,
MODEL_WIRED_VIDEO_DOORBELL2_2K,
MODEL_ESSENTIAL_VIDEO_DOORBELL,
MODEL_GO,
MODEL_GO_2,
MODEL_ESSENTIAL_XL,
Expand All @@ -48,7 +50,7 @@

_LOGGER = logging.getLogger("pyaarlo")

__version__ = "0.8.0.2"
__version__ = "0.8.0.3"


class PyArlo(object):
Expand Down Expand Up @@ -219,38 +221,45 @@ def __init__(self, **kwargs):
# This needs it's own code now... Does no parent indicate a base station???
if (
dtype == "basestation"
or dtype == "arlobridge"
or dtype.lower() == 'hub'
or device.get("modelId") == "ABC1000"
or device.get("modelId").startswith(MODEL_GO)
or dtype == "arloq"
or dtype == "arloqs"
):
self._bases.append(ArloBase(dname, self, device))

# Newer devices can connect directly to wifi and can be its own base station,
# it can also be assigned to a real base station
if (
device.get("modelId").startswith(MODEL_WIRED_VIDEO_DOORBELL)
or device.get("modelId").startswith(MODEL_PRO_3_FLOODLIGHT)
or device.get("modelId").startswith(MODEL_PRO_4)
or device.get("modelId").startswith(MODEL_PRO_5)
or device.get("modelId").startswith(MODEL_ESSENTIAL)
or device.get("modelId").startswith(MODEL_ESSENTIAL_INDOOR)
or device.get("modelId").startswith(MODEL_ESSENTIAL_XL)
or device.get("modelId").startswith(MODEL_WIREFREE_VIDEO_DOORBELL)
or device.get("modelId").startswith(MODEL_GO_2)
):
if device.get("modelId").startswith((
MODEL_WIRED_VIDEO_DOORBELL,
MODEL_PRO_3_FLOODLIGHT,
MODEL_PRO_4,
MODEL_PRO_5,
MODEL_ESSENTIAL,
MODEL_ESSENTIAL_INDOOR,
MODEL_ESSENTIAL_XL,
MODEL_WIRED_VIDEO_DOORBELL2_HD,
MODEL_WIRED_VIDEO_DOORBELL2_2K,
MODEL_ESSENTIAL_VIDEO_DOORBELL,
MODEL_GO_2
)):
parent_id = device.get("parentId", None)
if parent_id is None or parent_id == device.get("deviceId", None):
self._bases.append(ArloBase(dname, self, device))
if dtype == "arlobridge":
self._bases.append(ArloBase(dname, self, device))

if (
dtype == "camera"
or dtype == "arloq"
or dtype == "arloqs"
or device.get("modelId").startswith(MODEL_GO)
or device.get("modelId").startswith(MODEL_WIRED_VIDEO_DOORBELL)
or device.get("modelId").startswith(MODEL_WIREFREE_VIDEO_DOORBELL)
or device.get("modelId").startswith((
MODEL_GO,
MODEL_WIRED_VIDEO_DOORBELL,
MODEL_WIRED_VIDEO_DOORBELL2_HD,
MODEL_WIRED_VIDEO_DOORBELL2_2K,
MODEL_ESSENTIAL_VIDEO_DOORBELL
))
):
self._cameras.append(ArloCamera(dname, self, device))
if dtype == "doorbell":
Expand Down
20 changes: 12 additions & 8 deletions pyaarlo/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
MODEL_PRO_4,
MODEL_PRO_5,
MODEL_WIRED_VIDEO_DOORBELL,
MODEL_WIREFREE_VIDEO_DOORBELL,
MODEL_ESSENTIAL_VIDEO_DOORBELL,
PING_CAPABILITY,
RESOURCE_CAPABILITY,
RESTART_PATH,
Expand Down Expand Up @@ -563,10 +563,13 @@ def has_capability(self, cap):
return True

# Don't ping these devices ever.
if self.model_id.startswith(
(MODEL_WIREFREE_VIDEO_DOORBELL, MODEL_ESSENTIAL,
MODEL_PRO_3_FLOODLIGHT, MODEL_PRO_4, MODEL_PRO_5)
):
if self.model_id.startswith((
MODEL_ESSENTIAL_VIDEO_DOORBELL,
MODEL_ESSENTIAL,
MODEL_PRO_3_FLOODLIGHT,
MODEL_PRO_4,
MODEL_PRO_5
)):
return False

# We have to be careful pinging some base stations because it can rapidly
Expand All @@ -584,9 +587,10 @@ def has_capability(self, cap):

if cap in (RESOURCE_CAPABILITY,):
# Not all devices need (or want) to get their resources queried.
if self.model_id.startswith(
(MODEL_WIREFREE_VIDEO_DOORBELL, MODEL_ESSENTIAL)
):
if self.model_id.startswith((
MODEL_ESSENTIAL_VIDEO_DOORBELL,
MODEL_ESSENTIAL
)):
return False
return True
return super().has_capability(cap)
Expand Down
42 changes: 23 additions & 19 deletions pyaarlo/camera.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,9 @@
MODEL_PRO_5,
MODEL_ULTRA,
MODEL_WIRED_VIDEO_DOORBELL,
MODEL_WIREFREE_VIDEO_DOORBELL,
MODEL_WIRED_VIDEO_DOORBELL2_HD,
MODEL_WIRED_VIDEO_DOORBELL2_2K,
MODEL_ESSENTIAL_VIDEO_DOORBELL,
MODEL_GO,
MOTION_DETECTED_KEY,
MOTION_SENS_KEY,
Expand Down Expand Up @@ -1367,8 +1369,7 @@ def has_capability(self, cap):
if cap in (LAST_CAPTURE_KEY, CAPTURED_TODAY_KEY, RECENT_ACTIVITY_KEY):
return True
if cap in (AUDIO_DETECTED_KEY,):
if self.model_id.startswith(
(
if self.model_id.startswith((
MODEL_ESSENTIAL,
MODEL_ESSENTIAL_INDOOR,
MODEL_ESSENTIAL_XL,
Expand All @@ -1380,14 +1381,12 @@ def has_capability(self, cap):
MODEL_ULTRA,
MODEL_GO,
MODEL_BABY,
)
):
)):
return True
if self.device_type.startswith("arloq"):
return True
if cap in (SIREN_STATE_KEY,):
if self.model_id.startswith(
(
if self.model_id.startswith((
MODEL_ESSENTIAL,
MODEL_ESSENTIAL_INDOOR,
MODEL_ESSENTIAL_XL,
Expand All @@ -1396,15 +1395,20 @@ def has_capability(self, cap):
MODEL_PRO_4,
MODEL_PRO_5,
MODEL_ULTRA,
MODEL_WIREFREE_VIDEO_DOORBELL,
)
):
MODEL_WIRED_VIDEO_DOORBELL2_HD,
MODEL_WIRED_VIDEO_DOORBELL2_2K,
MODEL_ESSENTIAL_VIDEO_DOORBELL,
)):
return True
if cap in (SPOTLIGHT_KEY,):
if self.model_id.startswith(
(MODEL_ESSENTIAL, MODEL_ESSENTIAL_XL, MODEL_ESSENTIAL_XL, MODEL_PRO_3, MODEL_PRO_4, MODEL_PRO_5,
MODEL_ULTRA)
):
if self.model_id.startswith((
MODEL_ESSENTIAL,
MODEL_ESSENTIAL_XL,
MODEL_PRO_3,
MODEL_PRO_4,
MODEL_PRO_5,
MODEL_ULTRA
)):
return True
if cap in (TEMPERATURE_KEY, HUMIDITY_KEY, AIR_QUALITY_KEY):
if self.model_id.startswith(MODEL_BABY):
Expand All @@ -1417,20 +1421,20 @@ def has_capability(self, cap):
return True
if cap in (CONNECTION_KEY,):
# These devices are their own base stations so don't re-add connection key.
if self.parent_id == self.device_id and self.model_id.startswith(
(
if self.parent_id == self.device_id and self.model_id.startswith((
MODEL_BABY,
MODEL_PRO_3_FLOODLIGHT,
MODEL_PRO_4,
MODEL_PRO_5,
MODEL_ESSENTIAL,
MODEL_ESSENTIAL_XL,
MODEL_WIRED_VIDEO_DOORBELL,
MODEL_WIREFREE_VIDEO_DOORBELL,
MODEL_WIRED_VIDEO_DOORBELL2_HD,
MODEL_WIRED_VIDEO_DOORBELL2_2K,
MODEL_ESSENTIAL_VIDEO_DOORBELL,
MODEL_ESSENTIAL_INDOOR,
MODEL_GO,
)
):
)):
return False
if self.device_type in ("arloq", "arloqs"):
return False
Expand Down
7 changes: 5 additions & 2 deletions pyaarlo/constant.py
Original file line number Diff line number Diff line change
Expand Up @@ -273,17 +273,20 @@
MODEL_PRO_3_FLOODLIGHT = "FB1001"
MODEL_ULTRA = "VMC5040"
MODEL_BABY = "ABC1000"

MODEL_ESSENTIAL = "VMC2030"
MODEL_ESSENTIAL_INDOOR = "VMC2040"
MODEL_ESSENTIAL_XL = "VMC3052"
MODEL_ESSENTIAL_VIDEO_DOORBELL = "AVD2001"

MODEL_WIRED_VIDEO_DOORBELL = "AVD1001"
MODEL_WIREFREE_VIDEO_DOORBELL = "AVD2001"
MODEL_WIRED_VIDEO_DOORBELL2_HD = "AVD3001"
MODEL_WIRED_VIDEO_DOORBELL2_2K = "AVD4001"

MODEL_GO = "VML4030"
MODEL_GO_2 = "VML2030"

MODEL_ALL_IN_1_SENSOR = "MS1001"
MODEL_GO_2 = "VML2030"

USER_AGENTS = {
"arlo":
Expand Down
13 changes: 9 additions & 4 deletions pyaarlo/doorbell.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
CHIMES_KEY,
CONNECTION_KEY,
MODEL_WIRED_VIDEO_DOORBELL,
MODEL_WIREFREE_VIDEO_DOORBELL,
MODEL_WIRED_VIDEO_DOORBELL2_HD,
MODEL_WIRED_VIDEO_DOORBELL2_2K,
MODEL_ESSENTIAL_VIDEO_DOORBELL,
MOTION_DETECTED_KEY,
SIGNAL_STR_KEY,
SILENT_MODE_ACTIVE_KEY,
Expand Down Expand Up @@ -89,9 +91,12 @@ def resource_type(self):

@property
def is_video_doorbell(self):
return self.model_id.startswith(
MODEL_WIRED_VIDEO_DOORBELL
) or self.model_id.startswith(MODEL_WIREFREE_VIDEO_DOORBELL)
return self.model_id.startswith((
MODEL_WIRED_VIDEO_DOORBELL,
MODEL_WIRED_VIDEO_DOORBELL2_HD,
MODEL_WIRED_VIDEO_DOORBELL2_2K,
MODEL_ESSENTIAL_VIDEO_DOORBELL
))

def has_capability(self, cap):
# Video Doorbells appear as both ArloCameras and ArloDoorBells, where
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ def readme():
setup(

name='pyaarlo',
version='0.8.0.2',
version='0.8.0.3',
packages=['pyaarlo'],

python_requires='>=3.7',
Expand Down

0 comments on commit 72fd151

Please sign in to comment.