The Problem
The existing_doorbell_type property in doorbot.py raises a KeyError when the API returns chime type values not in the DOORBELL_EXISTING_TYPE dictionary. This affects newer doorbells like the Battery Doorbell Plus (cocoa_doorbell_v2).
File "/usr/local/lib/python3.13/site-packages/ring_doorbell/doorbot.py", line 193, in existing_doorbell_type
return DOORBELL_EXISTING_TYPE[dtype]
KeyError: 5
Device Information
- Device: Ring Battery Doorbell Plus (Australia)
- API
kind: cocoa_doorbell_v2
- ring-doorbell version: 0.9.13
- Home Assistant version: 2025.12.5
Root Cause
The current mapping in const.py only has 3 values:
DOORBELL_EXISTING_TYPE = {0: "Mechanical", 1: "Digital", 2: "Not Present"}
However, newer doorbells return additional values. Through testing, I've mapped the Ring app settings to API values:
| Ring App Setting |
API chime_settings.type |
In current mapping? |
| Digital Type 1 |
1 |
✓ "Digital" |
| None |
2 |
✓ "Not Present" |
| Digital Type 2 |
3 |
✗ KeyError |
| Initial/Unset |
5 |
✗ KeyError |
Note: "Mechanical" in the Ring app also returns 2 on this device (possibly because it's not actually wired to a mechanical chime, so the setting reverts).
Suggested Fix
Option 1: Expand the mapping (minimal change)
# const.py
DOORBELL_EXISTING_TYPE = {
0: "Mechanical",
1: "Digital",
2: "Not Present",
3: "Digital Type 2",
5: "Unset",
}
Option 2: Handle unknown types gracefully (recommended)
This prevents future breakage when Ring adds new chime types:
# doorbot.py, line ~193
@property
def existing_doorbell_type(self) -> str | None:
"""Return existing doorbell type."""
dtype = self._get_chime_setting("type")
if dtype is None:
return None
return DOORBELL_EXISTING_TYPE.get(dtype, f"Unknown ({dtype})")
Raw API Data
From Home Assistant diagnostics download, the relevant section:
{
"kind": "cocoa_doorbell_v2",
"settings": {
"chime_settings": {
"enable": true,
"type": 5,
"duration": 10
}
},
"features": {
"chime_settings": {
"is_eligible": true,
"auto_detect": {}
},
"chime_auto_detect_capable": true
}
}
Impact
This bug causes the Home Assistant Ring integration's switch platform to fail setup, preventing the in-home chime switch entity from being created. The rest of the integration works fine.
Related
The Problem
The
existing_doorbell_typeproperty indoorbot.pyraises aKeyErrorwhen the API returns chime type values not in theDOORBELL_EXISTING_TYPEdictionary. This affects newer doorbells like the Battery Doorbell Plus (cocoa_doorbell_v2).Device Information
kind:cocoa_doorbell_v2Root Cause
The current mapping in
const.pyonly has 3 values:However, newer doorbells return additional values. Through testing, I've mapped the Ring app settings to API values:
chime_settings.typeNote: "Mechanical" in the Ring app also returns
2on this device (possibly because it's not actually wired to a mechanical chime, so the setting reverts).Suggested Fix
Option 1: Expand the mapping (minimal change)
Option 2: Handle unknown types gracefully (recommended)
This prevents future breakage when Ring adds new chime types:
Raw API Data
From Home Assistant diagnostics download, the relevant section:
{ "kind": "cocoa_doorbell_v2", "settings": { "chime_settings": { "enable": true, "type": 5, "duration": 10 } }, "features": { "chime_settings": { "is_eligible": true, "auto_detect": {} }, "chime_auto_detect_capable": true } }Impact
This bug causes the Home Assistant Ring integration's switch platform to fail setup, preventing the in-home chime switch entity from being created. The rest of the integration works fine.
Related