From 68abeb7812a6de951686399a56ba2424ea327dff Mon Sep 17 00:00:00 2001 From: Daniel Roussel Date: Wed, 11 Sep 2024 20:30:03 +0200 Subject: [PATCH] add back old volume sensors but deprecate them --- homeassistant/components/ring/sensor.py | 45 ++++++++++++++++++++++++- 1 file changed, 44 insertions(+), 1 deletion(-) diff --git a/homeassistant/components/ring/sensor.py b/homeassistant/components/ring/sensor.py index 6e4863a0670..dee67882857 100644 --- a/homeassistant/components/ring/sensor.py +++ b/homeassistant/components/ring/sensor.py @@ -6,7 +6,14 @@ from collections.abc import Callable from dataclasses import dataclass from typing import Any, Generic, cast -from ring_doorbell import RingCapability, RingEventKind, RingGeneric +from ring_doorbell import ( + RingCapability, + RingChime, + RingDoorBell, + RingEventKind, + RingGeneric, + RingOther, +) from homeassistant.components.sensor import ( SensorDeviceClass, @@ -203,6 +210,42 @@ SENSOR_TYPES: tuple[RingSensorEntityDescription[Any], ...] = ( new_platform=Platform.EVENT, breaks_in_ha_version="2025.4.0" ), ), + RingSensorEntityDescription[RingDoorBell | RingChime]( + key="volume", + translation_key="volume", + value_fn=lambda device: device.volume, + exists_fn=lambda device: isinstance(device, (RingDoorBell, RingChime)), + deprecated_info=DeprecatedInfo( + new_platform=Platform.NUMBER, breaks_in_ha_version="2025.4.0" + ), + ), + RingSensorEntityDescription[RingOther]( + key="doorbell_volume", + translation_key="doorbell_volume", + value_fn=lambda device: device.doorbell_volume, + exists_fn=lambda device: isinstance(device, RingOther), + deprecated_info=DeprecatedInfo( + new_platform=Platform.NUMBER, breaks_in_ha_version="2025.4.0" + ), + ), + RingSensorEntityDescription[RingOther]( + key="mic_volume", + translation_key="mic_volume", + value_fn=lambda device: device.mic_volume, + exists_fn=lambda device: isinstance(device, RingOther), + deprecated_info=DeprecatedInfo( + new_platform=Platform.NUMBER, breaks_in_ha_version="2025.4.0" + ), + ), + RingSensorEntityDescription[RingOther]( + key="voice_volume", + translation_key="voice_volume", + value_fn=lambda device: device.voice_volume, + exists_fn=lambda device: isinstance(device, RingOther), + deprecated_info=DeprecatedInfo( + new_platform=Platform.NUMBER, breaks_in_ha_version="2025.4.0" + ), + ), RingSensorEntityDescription[RingGeneric]( key="wifi_signal_category", translation_key="wifi_signal_category",