add back old volume sensors but deprecate them

This commit is contained in:
Daniel Roussel
2024-09-11 20:30:03 +02:00
parent c713ecf4eb
commit 68abeb7812

View File

@@ -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",