mirror of
https://github.com/home-assistant/developers.home-assistant.git
synced 2025-07-13 20:36:29 +00:00
Update docs based on core PR review and changes
This commit is contained in:
parent
bbfc6ac654
commit
70d5b265c7
@ -11,9 +11,6 @@ A siren entity is a device whose main purpose is to control siren devices like a
|
||||
|
||||
| Name | Type | Default | Description |
|
||||
| ----------------------- | ------ | ------------------------------------- | --------------------------------------------------------------------------------------- |
|
||||
| volume_level | float | `None` | The volume level for the device. |
|
||||
| active_tone | string | `NotImplementedError()` | The active tone for the device. Requires `SUPPORT_TONES`. |
|
||||
| available_tones | list | `NotImplementedError()` | The available tones for the device. Requires `SUPPORT_TONES`. |
|
||||
| is_on | bool | `NotImplementedError()` | Whether the device is on or off. |
|
||||
|
||||
### Tones
|
||||
@ -25,41 +22,14 @@ A device can have different tones that are played. Integrations are responsible
|
||||
Supported features constants are combined using the bitwise or (`|`) operator.
|
||||
|
||||
| Name | Description |
|
||||
| ------------------------- | -------------------------------------------------------------- |
|
||||
| `SUPPORT_TONES` | The device supports different tones. |
|
||||
| `SUPPORT_VOLUME_SET` | The device supports setting the volume level of the device. |
|
||||
| ------------------------- | ---------------------------------------------------------------------------------------------------------------- |
|
||||
| `SUPPORT_TONES` | The device supports different tones (the tone is passed in to `turn_on` service). |
|
||||
| `SUPPORT_VOLUME_SET` | The device supports setting the volume level of the device (the volume level is passed in to `turn_on` service). |
|
||||
| `SUPPORT_DURATION` | The device supports setting a duration for the tone (the duration is passed in to `turn_on` service). |
|
||||
|
||||
|
||||
## Methods
|
||||
|
||||
### Set volume level
|
||||
|
||||
```python
|
||||
class MySirenEntity(SirenEntity):
|
||||
# Implement one of these methods.
|
||||
|
||||
def set_volume_level(self, volume_level: float):
|
||||
"""Set new volume level."""
|
||||
|
||||
async def async_set_volume_level(self, volume_level: float):
|
||||
"""Set new volume level."""
|
||||
```
|
||||
|
||||
### Set active tone
|
||||
|
||||
This should only be implemented if the tone can be changed.
|
||||
|
||||
```python
|
||||
class MySirenEntity(SirenEntity):
|
||||
# Implement one of these methods.
|
||||
|
||||
def set_active_tone(self, tone: str):
|
||||
"""Set new active tone."""
|
||||
|
||||
async def async_set_active_tone(self, tone: str):
|
||||
"""Set new active tone."""
|
||||
```
|
||||
|
||||
### Turn on
|
||||
|
||||
```python
|
||||
|
Loading…
x
Reference in New Issue
Block a user