mirror of
https://github.com/home-assistant/developers.home-assistant.git
synced 2025-07-13 20:36:29 +00:00
Add select integration (#969)
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
This commit is contained in:
parent
79e2681a42
commit
9e67de6b8a
38
docs/core/entity/select.md
Normal file
38
docs/core/entity/select.md
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
---
|
||||||
|
title: Select Entity
|
||||||
|
sidebar_label: Select
|
||||||
|
---
|
||||||
|
|
||||||
|
A `select` is an entity that allows the user to select an option from a list of limited options provided by the integration. Derive entity platforms from [`homeassistant.components.select.SelectEntity`](https://github.com/home-assistant/core/blob/dev/homeassistant/components/select/__init__.py)
|
||||||
|
|
||||||
|
This entity should only be used in cases there is no better fitting option available.
|
||||||
|
For example, a bulb can have user selectable light effects. While that could be done using this `select` entity, it should really be part of the `light` entity, which already supports light effects.
|
||||||
|
|
||||||
|
## Properties
|
||||||
|
|
||||||
|
> Properties should always only return information from memory and not do I/O (like network requests). Implement `update()` or `async_update()` to fetch data.
|
||||||
|
|
||||||
|
| Name | Type | Default | Description
|
||||||
|
| ---- | ---- | ------- | -----------
|
||||||
|
| current_option | str | None | The current select option
|
||||||
|
| options | list | **Required** | A list of available options as strings
|
||||||
|
|
||||||
|
Other properties that are common to all entities such as `icon`, `unit_of_measurement`, `name` etc are also applicable.
|
||||||
|
|
||||||
|
## Methods
|
||||||
|
|
||||||
|
### Select option
|
||||||
|
|
||||||
|
Called when the user or automation wants to change the current selected option.
|
||||||
|
|
||||||
|
```python
|
||||||
|
class MySelect(SelectEntity):
|
||||||
|
# Implement one of these methods.
|
||||||
|
|
||||||
|
def select_option(self, option: str) -> None:
|
||||||
|
"""Change the selected option."""
|
||||||
|
|
||||||
|
async def async_select_option(self, option: str) -> None:
|
||||||
|
"""Change the selected option."""
|
||||||
|
|
||||||
|
```
|
@ -161,6 +161,7 @@ module.exports = {
|
|||||||
"core/entity/media-player",
|
"core/entity/media-player",
|
||||||
"core/entity/number",
|
"core/entity/number",
|
||||||
"core/entity/remote",
|
"core/entity/remote",
|
||||||
|
"core/entity/select",
|
||||||
"core/entity/sensor",
|
"core/entity/sensor",
|
||||||
"core/entity/switch",
|
"core/entity/switch",
|
||||||
"core/entity/vacuum",
|
"core/entity/vacuum",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user