Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions ring_doorbell/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,9 +172,9 @@ def from_name(name: str) -> RingCapability:

FLOODLIGHT_CAM_KINDS = ["hp_cam_v1", "floodlight_v2"]
FLOODLIGHT_CAM_PRO_KINDS = ["floodlight_pro"]
FLOODLIGHT_CAM_PLUS_KINDS = ["cocoa_floodlight"]
FLOODLIGHT_CAM_PLUS_KINDS = ["cocoa_floodlight", "cocoa_floodlight_v2"]
INDOOR_CAM_KINDS = ["stickup_cam_mini"]
INDOOR_CAM_GEN2_KINDS = ["stickup_cam_mini_v2"]
INDOOR_CAM_GEN2_KINDS = ["stickup_cam_mini_v2", "stickup_cam_mini_v3"]
INDOOR_CAM_PTZ_KINDS = ["stickup_cam_mini_ptz_v1"]
SPOTLIGHT_CAM_BATTERY_KINDS = ["stickup_cam_v4"]
SPOTLIGHT_CAM_WIRED_KINDS = ["hp_cam_v2", "spotlightw_v2"]
Expand All @@ -184,7 +184,7 @@ def from_name(name: str) -> RingCapability:
STICKUP_CAM_BATTERY_KINDS = ["stickup_cam_lunar"]
STICKUP_CAM_ELITE_KINDS = ["stickup_cam_elite", "stickup_cam_wired"]
STICKUP_CAM_WIRED_KINDS = STICKUP_CAM_ELITE_KINDS # Deprecated
STICKUP_CAM_GEN3_KINDS = ["cocoa_camera"]
STICKUP_CAM_GEN3_KINDS = ["cocoa_camera", "cocoa_camera_v3"]
BEAM_KINDS = ["beams_ct200_transformer"]

INTERCOM_KINDS = ["intercom_handset_audio", "intercom_handset_video"]
Expand Down
38 changes: 37 additions & 1 deletion tests/test_ring.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@

import asyncio
from datetime import datetime, timezone
from unittest.mock import PropertyMock, patch

import pytest
from freezegun.api import FrozenDateTimeFactory
from ring_doorbell import Auth, Ring, RingError
from ring_doorbell import Auth, Ring, RingError, RingStickUpCam
from ring_doorbell.const import MSG_EXISTING_TYPE, USER_AGENT
from ring_doorbell.util import parse_datetime

Expand Down Expand Up @@ -113,6 +114,41 @@ def test_stickup_cam_attributes(ring):
assert dev.siren == 0


@pytest.mark.parametrize(
("kind", "expected_model", "battery", "light", "siren"),
[
# Newer Ring camera kinds (#525) added to their existing device-kind
# families so they classify correctly instead of falling through to the
# generic profile and logging "Unknown kind".
("cocoa_floodlight_v2", "Floodlight Cam Plus", False, True, True),
("cocoa_camera_v3", "Stick Up Cam (3rd Gen)", True, False, True),
("stickup_cam_mini_v3", "Indoor Cam (2nd Gen)", False, False, True),
],
)
def test_newer_stickup_cam_kinds_recognized(
kind, expected_model, battery, light, siren
):
"""Each newer kind must map to its family's model + capabilities.

model/has_capability read only ``self.kind`` for these families, so patching
that one property pins the classification without the network fixtures — in
particular that model() never returns the "Unknown Stickup Cam" fallback.
"""
cam = RingStickUpCam.__new__(RingStickUpCam)
with patch.object(
RingStickUpCam, "kind", new_callable=PropertyMock, return_value=kind
):
assert cam.kind == kind
assert cam.model == expected_model
assert cam.model != "Unknown Stickup Cam"
assert cam.has_capability("battery") is battery
assert cam.has_capability("light") is light
assert cam.has_capability("siren") is siren
# all of these are cameras → video/motion + history are always present
assert cam.has_capability("motion_detection") is True
assert cam.has_capability("history") is True


async def test_stickup_cam_controls(ring, aioresponses_mock):
dev = ring.devices()["stickup_cams"][0]

Expand Down