Added Restore state info + Updated config style (#4343)
* Updated input_boolean * new Configuration style * Linkable title Automation Examples * Updated input_select * new Configuration style * Services as table * Rearaged scenes * small improvments * Updated input_number * linkformat * Updated input_text * New configuration style * Update input_datetime * New configuration style * Updated recorder * New configuration style * Added Restore State Info
This commit is contained in:
parent
c624d5fc00
commit
5b873e2380
6 changed files with 214 additions and 69 deletions
|
@ -33,27 +33,64 @@ input_select:
|
|||
- Home Alone
|
||||
```
|
||||
|
||||
Configuration variables:
|
||||
|
||||
- **[alias]** array (*Required*): Alias for the input. Multiple entries are allowed..
|
||||
- **name** (*Optional*): Friendly name of the input.
|
||||
- **options** array (*Required*): List of options to choose from.
|
||||
- **initial** (*Optional*): Initial value when Home Assistant starts.
|
||||
- **icon** (*Optional*): Icon for entry.
|
||||
|
||||
Pick an icon that you can find on [materialdesignicons.com](https://materialdesignicons.com/) to use for your input and prefix the name with `mdi:`. For example `mdi:car`, `mdi:ambulance`, or `mdi:motorbike`.
|
||||
{% configuration %}
|
||||
input_select:
|
||||
description: Alias for the input. Multiple entries are allowed.
|
||||
required: true
|
||||
type: map
|
||||
keys:
|
||||
name:
|
||||
description: Friendly name of the input.
|
||||
required: false
|
||||
type: String
|
||||
options:
|
||||
description: List of options to choose from.
|
||||
required: true
|
||||
type: Array
|
||||
initial:
|
||||
description: Initial value when Home Assistant starts.
|
||||
required: false
|
||||
type: Element of options
|
||||
default: First element of options
|
||||
icon:
|
||||
description: Icon to display for the component. Refer to the [Customizing devices](/docs/configuration/customizing-devices/#possible-values) page for possible values.
|
||||
required: false
|
||||
type: icon
|
||||
{% endconfiguration %}
|
||||
|
||||
<p class='note'>
|
||||
Because YAML defines [booleans](http://yaml.org/type/bool.html) as equivalent, any variations of 'On', 'Yes', 'Y', 'Off', 'No', or 'N' (regardless of case) used as option names will be replaced by True and False unless they are defined in quotation marks.
|
||||
</p>
|
||||
|
||||
### {% linkable_title Restore State %}
|
||||
|
||||
This component supports the `restore_state` function which restores the state value after Home Assistant has started to the value it has been before Home Assistant stopped. The use this feature please make sure that the [`recorder`](/components/recorder/) component is enabled and your entity does not have and initial value. Additional information and a list of components that support this feature can be found here [recorder/#restore-state](/components/recorder/#restore-state).
|
||||
|
||||
### {% linkable_title Services %}
|
||||
|
||||
This components provide three services to modify the state of the `input_select`:
|
||||
This components provide three services to modify the state of the `input_select`.
|
||||
|
||||
- `input_select.select_option`: This can be used to select a specific option. The option is passed as `option` attribute in the service data.
|
||||
- `input_select.select_previous`: Select the previous option.
|
||||
- `input_select.select_next`: Select the next option.
|
||||
| Service | Data | Description |
|
||||
| ------- | ---- | ----------- |
|
||||
| `select_option` | `option` | This can be used to select a specific option.
|
||||
| `set_options` | `options`<br>`entity_id(s)` | Set the options for specific `input_select` entities.
|
||||
| `select_previous` | | Select the previous option.
|
||||
| `select_next` | | Select the next option.
|
||||
|
||||
### {% linkable_title Scenes %}
|
||||
|
||||
To specify a target option in a [Scene](/components/scene/) you have to specify the target as `option` attribute:
|
||||
|
||||
```yaml
|
||||
# Example configuration.yaml entry
|
||||
scene:
|
||||
- name: Example1
|
||||
entities:
|
||||
input_select.who_cooks:
|
||||
option: Paulus
|
||||
```
|
||||
|
||||
## {% linkable_title Automation Examples %}
|
||||
|
||||
The following example shows the usage of the `input_select.select_option` service in an automation:
|
||||
|
||||
|
@ -87,23 +124,10 @@ automation:
|
|||
options: ["Item A", "Item B", "Item C"]
|
||||
```
|
||||
|
||||
### {% linkable_title Scenes %}
|
||||
|
||||
To specify a target option in a [Scene](/components/scene/) you have to specify the target as `option` attribute:
|
||||
|
||||
```yaml
|
||||
# Example configuration.yaml entry
|
||||
scene:
|
||||
- name: Example1
|
||||
entities:
|
||||
input_select.who_cooks:
|
||||
option: Paulus
|
||||
```
|
||||
|
||||
Example of `input_select` being used in a bidirectional manner, both being set by and controlled by an MQTT action in an automation.
|
||||
|
||||
```yaml
|
||||
{% raw %}
|
||||
```yaml
|
||||
# Example configuration.yaml entry using 'input_select' in an action in an automation
|
||||
|
||||
# Define input_select
|
||||
|
@ -129,7 +153,7 @@ input_select:
|
|||
service: input_select.select_option
|
||||
data_template:
|
||||
entity_id: input_select.thermostat_mode
|
||||
option: '{{ trigger.payload }}'
|
||||
option: "{{ trigger.payload }}"
|
||||
|
||||
# This automation script runs when the thermostat mode selector is changed.
|
||||
# It publishes its value to the same MQTT topic it is also subscribed to.
|
||||
|
@ -142,6 +166,6 @@ input_select:
|
|||
data_template:
|
||||
topic: "thermostatMode"
|
||||
retain: true
|
||||
payload: '{{ states.input_select.thermostat_mode.state }}'
|
||||
{% endraw %}
|
||||
payload: "{{ states('input_select.thermostat_mode') }}"
|
||||
```
|
||||
{% endraw %}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue