Skip to main content

Siren entity

A siren entity is a device whose main purpose is to control siren devices like a doorbell or chime. Derive entity platforms from homeassistant.components.siren.SirenEntity

Properties

tip

Properties should always only return information from memory and not do I/O (like network requests). Implement update() or async_update() to fetch data or build a mechanism to push state updates to the entity class instance.

NameTypeDefaultDescription
is_onboolNoneWhether the device is on or off.
available_toneslist or dictNotImplementedError()The list or dictionary of available tones on the device to pass into the turn_on service action. If a dictionary is provided, when a user uses the dict value of a tone, it will get converted to the corresponding dict key before being passed on to the integration platform. Requires SUPPORT_TONES feature.

Tones

A device can have different tones that are played. Integrations are responsible for providing the available tones when supported.

Supported features

Supported features constants are combined using the bitwise or (|) operator.

NameDescription
SirenEntityFeature.TONESThe device supports different tones (the tone can be passed in to turn_on service action).
SirenEntityFeature.DURATIONThe device supports setting a duration for the tone (the duration can be passed in to turn_on service action).
SirenEntityFeature.VOLUME_SETThe device supports setting the volume level of the device (the volume level can be passed in to turn_on service action).

Methods

Turn on

There are three optional input parameters that can be passed into the service action call, each gated by a supported feature flag. If the corresponding flag isn't set when a given input parameter is provided in the service action call, it will be filtered out from the call by the base platform before being passed to the integration.

Parameter NameData ValidationSupported Feature Flag
tonevol.Any(vol.Coerce(int), cv.string)SUPPORT_TONES
durationcv.positive_intSUPPORT_DURATIONS
volume_levelcv.small_floatSUPPORT_VOLUME_SET
class MySirenEntity(SirenEntity):
# Implement one of these methods.

def turn_on(self, **kwargs) -> None:
"""Turn the device on."""

async def async_turn_on(self, **kwargs) -> None:
"""Turn the device on."""

Turn off

class MySirenEntity(SirenEntity):
# Implement one of these methods.

def turn_off(self, **kwargs):
"""Turn the device off."""

async def async_turn_off(self, **kwargs):
"""Turn the device off."""