mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 13:17:32 +00:00
Additional fixes for siren platform (#52971)
This commit is contained in:
parent
777fec62a5
commit
026ca4e4e4
@ -63,11 +63,10 @@ def process_turn_on_params(
|
|||||||
|
|
||||||
if not supported_features & SUPPORT_TONES:
|
if not supported_features & SUPPORT_TONES:
|
||||||
params.pop(ATTR_TONE, None)
|
params.pop(ATTR_TONE, None)
|
||||||
elif ATTR_TONE in params and (
|
elif (tone := params.get(ATTR_TONE)) is not None and (
|
||||||
not siren.available_tones
|
not siren.available_tones or tone not in siren.available_tones
|
||||||
or (tone := params[ATTR_TONE]) not in siren.available_tones
|
|
||||||
):
|
):
|
||||||
raise ValueError(f"Tone {tone} is not a valid tone for this device")
|
raise ValueError(f"Invalid tone received for entity {siren.entity_id}: {tone}")
|
||||||
|
|
||||||
if not supported_features & SUPPORT_DURATION:
|
if not supported_features & SUPPORT_DURATION:
|
||||||
params.pop(ATTR_DURATION, None)
|
params.pop(ATTR_DURATION, None)
|
||||||
|
@ -9,10 +9,9 @@ class MockSirenEntity(SirenEntity):
|
|||||||
|
|
||||||
_attr_is_on = True
|
_attr_is_on = True
|
||||||
|
|
||||||
@property
|
def __init__(self, supported_features: int = 0) -> None:
|
||||||
def supported_features(self) -> int:
|
"""Initialize mock siren entity."""
|
||||||
"""Return the list of supported features."""
|
self._attr_supported_features = supported_features
|
||||||
return 0
|
|
||||||
|
|
||||||
|
|
||||||
async def test_sync_turn_on(hass):
|
async def test_sync_turn_on(hass):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user