Added basic usage example (#2498)
* Added basic usage example Document is not easy to follow for people who do not have some experience using ESPHome. I added simple usage example to help them starting up. * Update index.rst Co-authored-by: H. Árkosi Róbert <robreg@zsurob.hu>
This commit is contained in:
parent
d931e55d50
commit
3d4d6bdca1
|
@ -334,6 +334,30 @@ advanced stuff (see the full API Reference for more info).
|
|||
if (id(my_select).has_index(index)) {
|
||||
ESP_LOGI("main", "Select has index offset %d", index);
|
||||
}
|
||||
|
||||
|
||||
Example
|
||||
-------
|
||||
|
||||
Setting up three options and set component state to selected option value.
|
||||
|
||||
.. code-block:: yaml
|
||||
|
||||
select:
|
||||
- platform: template
|
||||
name: Mode
|
||||
id: mode
|
||||
options:
|
||||
- "Option1"
|
||||
- "Option2"
|
||||
- "Option3"
|
||||
set_action:
|
||||
- logger.log:
|
||||
format: "Chosen option: %s"
|
||||
args: ["x.c_str()"]
|
||||
- lambda: |-
|
||||
id(mode).state = x.c_str();
|
||||
|
||||
|
||||
See Also
|
||||
--------
|
||||
|
|
Loading…
Reference in New Issue