From 26a3643f10b2a71e3d494bd0b9b9a3bcb73c1d6c Mon Sep 17 00:00:00 2001 From: DubhAd Date: Sun, 13 Jan 2019 10:41:55 +0000 Subject: [PATCH] We didn't document the services (#8147) Adding documentation on how to use the services. Actually, adding documentation on _what_ the service is ;) --- source/_components/input_text.markdown | 44 ++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/source/_components/input_text.markdown b/source/_components/input_text.markdown index cfa3ec4cdf7..4907e82659a 100644 --- a/source/_components/input_text.markdown +++ b/source/_components/input_text.markdown @@ -70,6 +70,50 @@ input_text: default: text {% endconfiguration %} +### {% linkable_title Services %} + +This components provide three services to modify the state of the `input_text`. + +| Service | Data | Description | +| ------- | ---- | ----------- | +| `set_value` | `value`
`entity_id(s)` | Set the value for specific `input_text` entities. + ### {% linkable_title Restore State %} This component will automatically restore the state it had prior to Home Assistant stopping as long as your entity does **not** have a set value for `initial`. To disable this feature, set a valid value for `initial`. + +## {% linkable_title Automation Examples %} + +Here's an example using `input_text` in an action in an automation. + +{% raw %} +```yaml +# Example configuration.yaml entry using 'input_text' in an action in an automation +input_select: + scene_bedroom: + name: Scene + options: + - Select + - Concentrate + - Energize + - Reading + - Relax + - 'OFF' + initial: 'Select' +input_text: + bedroom: + name: Brightness + +automation: + - alias: Bedroom Light - Custom + trigger: + platform: state + entity_id: input_select.scene_bedroom + action: + - service: input_text.set_value + # Again, note the use of 'data_template:' rather than the normal 'data:' if you weren't using an input variable. + data_template: + entity_id: input_text.bedroom + value: "{{ states('input_select.scene_bedroom') }}" +``` +{% endraw %}