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
1 change: 1 addition & 0 deletions ring_doorbell/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,7 @@ 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_2K_KINDS = ["osprey_floodlight"]
INDOOR_CAM_KINDS = ["stickup_cam_mini"]
INDOOR_CAM_GEN2_KINDS = ["stickup_cam_mini_v2"]
INDOOR_CAM_PTZ_KINDS = ["stickup_cam_mini_ptz_v1"]
Expand Down
6 changes: 6 additions & 0 deletions ring_doorbell/stickup_cam.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
from typing import ClassVar

from ring_doorbell.const import (
FLOODLIGHT_CAM_2K_KINDS,
FLOODLIGHT_CAM_KINDS,
FLOODLIGHT_CAM_PLUS_KINDS,
FLOODLIGHT_CAM_PRO_KINDS,
Expand Down Expand Up @@ -52,6 +53,8 @@ def model(self) -> str: # noqa: C901, PLR0911, PLR0912
return "Floodlight Cam Pro"
if self.kind in FLOODLIGHT_CAM_PLUS_KINDS:
return "Floodlight Cam Plus"
if self.kind in FLOODLIGHT_CAM_2K_KINDS:
return "Floodlight Cam 2K"
if self.kind in INDOOR_CAM_KINDS:
return "Indoor Cam"
if self.kind in INDOOR_CAM_GEN2_KINDS:
Expand Down Expand Up @@ -102,6 +105,7 @@ def has_capability(self, capability: RingCapability | str) -> bool:
FLOODLIGHT_CAM_KINDS
+ FLOODLIGHT_CAM_PRO_KINDS
+ FLOODLIGHT_CAM_PLUS_KINDS
+ FLOODLIGHT_CAM_2K_KINDS
+ SPOTLIGHT_CAM_BATTERY_KINDS
+ SPOTLIGHT_CAM_WIRED_KINDS
+ SPOTLIGHT_CAM_PLUS_KINDS
Expand All @@ -112,6 +116,7 @@ def has_capability(self, capability: RingCapability | str) -> bool:
FLOODLIGHT_CAM_KINDS
+ FLOODLIGHT_CAM_PRO_KINDS
+ FLOODLIGHT_CAM_PLUS_KINDS
+ FLOODLIGHT_CAM_2K_KINDS
+ INDOOR_CAM_KINDS
+ INDOOR_CAM_GEN2_KINDS
+ INDOOR_CAM_PTZ_KINDS
Expand All @@ -128,6 +133,7 @@ def has_capability(self, capability: RingCapability | str) -> bool:
FLOODLIGHT_CAM_KINDS
+ FLOODLIGHT_CAM_PRO_KINDS
+ FLOODLIGHT_CAM_PLUS_KINDS
+ FLOODLIGHT_CAM_2K_KINDS
+ INDOOR_CAM_KINDS
+ INDOOR_CAM_GEN2_KINDS
+ INDOOR_CAM_PTZ_KINDS
Expand Down
58 changes: 58 additions & 0 deletions tests/fixtures/ring_devices.json
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,64 @@
"stolen": false,
"subscribed": true,
"subscribed_motions": true,
"time_zone": "America/New_York" },
{
"address": "123 Main St",
"alerts": {"connection": "online"},
"battery_life": null,
"description": "Back",
"device_id": "aacdef125",
"external_connection": false,
"features": {
"advanced_motion_enabled": true,
"motion_message_enabled": false,
"motions_enabled": true,
"night_vision_enabled": false,
"people_only_enabled": false,
"shadow_correction_enabled": false,
"show_recordings": true},
"firmware_version": "cam-1.5.13222",
"id": 987654,
"kind": "osprey_floodlight",
"latitude": 12.000000,
"led_status": "off",
"location_id": "mock-location-id",
"longitude": -70.12345,
"motion_snooze": {"scheduled": true},
"night_mode_status": "false",
"owned": true,
"owner": {
"email": "foo@bar.org",
"first_name": "Foo",
"id": 999999,
"last_name": "Bar"},
"ring_cam_light_installed": "false",
"ring_id": null,
"settings": {
"chime_settings": {
"duration": 10,
"enable": true,
"type": 0},
"doorbell_volume": 8,
"enable_vod": true,
"floodlight_settings": {
"duration": 60,
"brightness": 10,
"always_on": false,
"priority": 0},
"live_view_preset_profile": "middle",
"live_view_presets": [
"low",
"middle",
"high",
"highest"],
"motion_detection_enabled": true,
"motion_announcement": false,
"power_mode": "wired"},
"siren_status": {"seconds_remaining": 0},
"stolen": false,
"subscribed": true,
"subscribed_motions": true,
"time_zone": "America/New_York" }],
"other": [
{
Expand Down
3 changes: 2 additions & 1 deletion tests/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,8 @@ async def test_list(ring):

expected = (
"Front Door (lpd_v1)\nBack Door (lpd_v1)\nDownstairs (chime)\n"
"Front (hp_cam_v1)\nIngress (intercom_handset_audio)\n"
"Front (hp_cam_v1)\nBack (osprey_floodlight)\n"
"Ingress (intercom_handset_audio)\n"
)

assert res.exit_code == 0
Expand Down
19 changes: 18 additions & 1 deletion tests/test_ring.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def test_basic_attributes(ring):
assert len(data["chimes"]) == 1
assert len(data["doorbots"]) == 1
assert len(data["authorized_doorbots"]) == 1
assert len(data["stickup_cams"]) == 1
assert len(data["stickup_cams"]) == 2
assert len(data["other"]) == 1


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


def test_osprey_floodlight_attributes(ring):
"""Osprey Floodlight Cam 2K reports light and siren capabilities (#558)."""
dev = next(
d for d in ring.devices()["stickup_cams"] if d.kind == "osprey_floodlight"
)
assert dev.id == 987654
assert dev.model == "Floodlight Cam 2K"
assert dev.has_capability("battery") is False
assert dev.has_capability("light") is True
assert dev.has_capability("siren") is True
assert dev.has_capability("motion_detection") is True
assert dev.has_capability("video") is True
assert dev.has_capability("history") is True
assert dev.lights == "off"
assert dev.siren == 0


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

Expand Down