Select
The Select integration集成将 Home Assistant 与您的设备、服务等连接和集成。 [Learn more] manages the state of the select entities and allows you to control them. This integration allows other integrations to offer a limited set of selectable options for the entity.
构建模块集成
这个 select 是一个构建模块集成,无法直接添加到你的 Home Assistant 中,但可以被其他集成使用和提供。
构建模块集成不同于典型的与设备或服务连接的集成。相反,其他将设备或服务集成到 Home Assistant 中的集成使用这个 select 构建模块来提供实体、服务和其他你可以在自动化或仪表板中使用的功能。
如果你的某个集成具有这个构建模块,这个页面记录了 select 构建模块所提供的功能。
The state of a select entity
The state of a select entity is the value of the currently selected option.
Screenshot showing the state of a select entity in the developer tools.
In addition, the entity can have the following states:
- Unavailable: The entity is currently unavailable.
- Unknown: The state is not yet known.
Actions
The select entity实体表示 Home Assistant 中的传感器、执行器或功能。实体用于监控物理属性或控制其他实体。实体通常是设备或服务的一部分。 [Learn more] exposes additional actions动作在 Home Assistant 的多个地方使用。作为脚本或自动化的一部分,动作定义了触发器被激活后将发生的事情。在脚本中,动作被称为序列。 [Learn more] to control the entity in, for example, automationHome Assistant 中的自动化允许您自动响应在家中和周围发生的事情。 [Learn more] or scripts脚本是允许用户指定 Home Assistant 打开时要执行的动作序列的组件。 [Learn more]. These actions can be created via the UI, but are also available in YAML (for which examples are provided below).
Action select.select_first
The select.select_first
action
changes the selected option of the select entity to the first option in the
list of options available.
This action does not have additional options.
An example in YAML:
action: select.select_first
target:
entity_id: select.my_entity
Action select.select_last
The select.select_last
action changes
the selected option of the select entity to the last option in the list of
options available.
This action does not have additional options.
An example in YAML:
action: select.select_last
target:
entity_id: select.my_entity
Action select.select_next
The select.select_next
action changes
the selected option of the select entity to the next option in the list of
options available. If the current select option is unknown, the first option
in the list is selected instead.
In case the current select option is the last option in the list, it will by
default, cycle back the first option and select that one instead. This cycle
behavior can be disabled by setting the cycle
option to false
in the
action data.
Examples in YAML:
action: select.select_next
target:
entity_id: select.my_entity
# Disable cycling back to the first option
action: select.select_next
target:
entity_id: select.my_entity
data:
cycle: false
Action select.select_option
The select.select_option
action
changes the selected option to a specific desired option provided in the
action using the required option
action data.
The action call will not succeed if the selected option is not available in the list of options for the targeted entity.
An example in YAML:
action: select.select_option
target:
entity_id: select.my_entity
data:
option: "example_option"
Action select.select_previous
The select.select_previous
action
changes the selected option of the select entity to the previous option in the
list of options available. If the current select option is unknown, the
last option in the list is selected instead.
In case the current select option is the first option in the list, it will by
default, cycle back the last option and select that one instead. This cycle
behavior can be disabled by setting the cycle
option to false
in the
action data.
Examples in YAML:
action: select.select_previous
target:
entity_id: select.my_entity
# Disable cycling back to the last option
action: select.select_previous
target:
entity_id: select.my_entity
data:
cycle: false