Skip to content

Fix/cocoa doorbell v5 support - #518

Closed
iweinzierl wants to merge 2 commits into
python-ring-doorbell:masterfrom
iweinzierl:fix/cocoa-doorbell-v5-support
Closed

Fix/cocoa doorbell v5 support#518
iweinzierl wants to merge 2 commits into
python-ring-doorbell:masterfrom
iweinzierl:fix/cocoa-doorbell-v5-support

Conversation

@iweinzierl

Copy link
Copy Markdown

### Summary
When a Ring device with newer firmware (observed on cocoa_doorbell_v5) sends a push notification via FCM, the event listener raises a KeyError: 'id' and shuts down after 3 errors. As a result, motion and ding events are never delivered.

Root cause

_get_ring_event() in eventlistener.py unconditionally accesses event["ding"]["id"]:

event_id = int(ding["id"]) # KeyError if "id" is absent

Newer Ring firmware sends FCM notifications in the modern (non-gcmData) format where the ding object does not include an "id" field. Instead, a unique per-event identifier is available as event["eventito"]["timestamp"] (millisecond epoch).

Example payload (relevant excerpt)
{ "event": { "ding": { "created_at": "2026-03-06T12:27:09Z", "subtype": "human", "detection_type": "human" }, "eventito": { "timestamp": 1772800029955, "type": "human" } } }
Note: ding has no "id" field.

Observed error

KeyError: 'id' File ".../eventlistener.py", line NNN, in _get_ring_event event_id = int(ding["id"])

After 3 such errors the listener stops receiving events (ErrorType.NOTIFY).

Suggested fix

Fall back to eventito["timestamp"] when ding["id"] is absent:
eventito = event.get("eventito", {}) if "id" in ding: event_id = int(ding["id"]) elif "timestamp" in eventito: event_id = int(eventito["timestamp"]) else: event_id = int(time.time() * 1000)

eventito["timestamp"] is unique per event and suitable for deduplication. Using the device ID as a fallback would be incorrect because it would treat every subsequent event from the same device as an update rather than a new event.

The bug issue is the more impactful one — it completely breaks real-time event delivery for affected devices. I'd suggest opening the bug report first and referencing it from the PR.> DOORBELL_PRO_3_KINDS = ["cocoa_doorbell_v5"]

…nt parsing

- Add cocoa_doorbell_v5 to DOORBELL_PRO_3_KINDS in const.py
- Map model name 'Doorbell Pro (3rd Gen)' and capabilities in doorbot.py
- Fix KeyError: 'id' in _get_ring_event when ding object has no id field
  (newer Ring firmware omits ding.id; use eventito.timestamp as fallback)
- Add fixture files and tests for the no-ding-id FCM payload format
@AMoo-Miki

Copy link
Copy Markdown

@iweinzierl, wouldnt riid be more suitable as a unique identifier to use?

@iweinzierl

iweinzierl commented Mar 26, 2026

Copy link
Copy Markdown
Author

@iweinzierl, wouldnt riid be more suitable as a unique identifier to use?

@AMoo-Miki , I thought the same when I started working on the PR, but when I analyzed multiple events, I figured out that the value of the riid attribute is not unique but the same across multiple events.

@github-actions

Copy link
Copy Markdown

There hasn't been any activity on this pull request recently. This pull request has been automatically marked as stale because of that and will be closed if no further activity occurs within 7 days.
If you are the author of this PR, please leave a comment if you want to keep it open. Also, please rebase your PR onto the latest dev branch to ensure that it's up to date with the latest changes.
Thank you for your contribution!

@github-actions github-actions Bot added the stale Stale PRs and Issues label Jun 25, 2026
@github-actions github-actions Bot closed this Jul 3, 2026
@MasterDevwi

Copy link
Copy Markdown

@iweinzierl Do you think we could reopen this or create a new PR with your fixes?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

stale Stale PRs and Issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants