mirror of
https://github.com/home-assistant/core.git
synced 2025-04-24 09:17:53 +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:
|
||||
params.pop(ATTR_TONE, None)
|
||||
elif ATTR_TONE in params and (
|
||||
not siren.available_tones
|
||||
or (tone := params[ATTR_TONE]) not in siren.available_tones
|
||||
elif (tone := params.get(ATTR_TONE)) is not None and (
|
||||
not siren.available_tones or 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:
|
||||
params.pop(ATTR_DURATION, None)
|
||||
|
@ -9,10 +9,9 @@ class MockSirenEntity(SirenEntity):
|
||||
|
||||
_attr_is_on = True
|
||||
|
||||
@property
|
||||
def supported_features(self) -> int:
|
||||
"""Return the list of supported features."""
|
||||
return 0
|
||||
def __init__(self, supported_features: int = 0) -> None:
|
||||
"""Initialize mock siren entity."""
|
||||
self._attr_supported_features = supported_features
|
||||
|
||||
|
||||
async def test_sync_turn_on(hass):
|
||||
|
Loading…
x
Reference in New Issue
Block a user