Stepper combine lambda docs (#223)

## Description:
#222 

**Related issue (if applicable):** fixes <link to issue>

**Pull request in [esphome](https://github.com/esphome/esphome) with YAML changes (if applicable):** esphome/esphome#<esphome PR number goes here>
**Pull request in [esphome-core](https://github.com/esphome/esphome-core) with C++ framework changes (if applicable):** esphome/esphome-core#<esphome-core PR number goes here>

## Checklist:

  - [x] Branch: `next` is for changes and new documentation that will go public with the next ESPHome release. Fixes, changes and adjustments for the current release should be created against `current`.


Co-authored-by: Otto Winter <otto@otto-winter.com>
This commit is contained in:
Aalian Khan 2019-04-09 05:05:03 -04:00 committed by Otto Winter
parent 8ada25472e
commit 3bf3f3438d

View File

@ -155,17 +155,6 @@ Configuration options:
id: my_stepper
target: 150
.. note::
This action can also be expressed as a :ref:`lambda <config-lambda>`:
.. code-block:: cpp
id(my_stepper).set_target(250);
// Get the currently set target position:
int target = id(my_stepper).target_position;
.. _stepper-report_position_action:
``stepper.report_position`` Action
@ -206,17 +195,6 @@ Configuration options:
- **id** (**Required**, :ref:`config-id`): The ID of the stepper.
- **target** (*Optional*, int, :ref:`templatable <config-templatable>`): The target position in steps.
.. note::
This action can also be expressed as a :ref:`lambda <config-lambda>`:
.. code-block:: cpp
id(my_stepper).report_position(250);
// Get the current position:
int pos = id(my_stepper).current_position;
.. _stepper-ha-config:
Home Assistant Configuration
@ -268,6 +246,41 @@ be able to control the stepper from the frontend.
# [...] stepper config
id: my_stepper
.. _stepper-lambda_calls:
lambda calls
------------
From :ref:`lambdas <config-lambda>`, you can call several methods on stepper motors to do some
advanced stuff (see the full API Reference for more info).
- ``set_target``: Set the target postion of the motor as an integer.
.. code-block:: cpp
// Argument is integer (signed int)
// Set the (absolute) target position to 250 steps
id(my_stepper).set_target(250);
- ``report_position``: Report the current postion as an integer.
.. code-block:: cpp
// Report the (absolute) current position as 250 steps
id(my_stepper).report_position(250);
- ``current_postion``: Get the current postion of the stepper as an integer.
.. code-block:: cpp
int pos = id(my_stepper).current_position;
- ``target_position``: Get the set target postion of the stepper as an integer.
.. code-block:: cpp
int pos = id(my_stepper).target_position;
See Also
--------