1
0
mirror of https://github.com/esphome/esphome.git synced 2025-09-13 00:32:20 +01:00

Add Stepper Motor Support (#206)

* Add stepper support

* Fix output set_level

* Lint
This commit is contained in:
Otto Winter
2018-10-26 22:57:03 +02:00
committed by GitHub
parent 21c22fe04a
commit af4e2bf61d
6 changed files with 202 additions and 3 deletions

View File

@@ -5,7 +5,7 @@ import esphomeyaml.config_validation as cv
from esphomeyaml.components.power_supply import PowerSupplyComponent
from esphomeyaml.const import CONF_INVERTED, CONF_MAX_POWER, CONF_POWER_SUPPLY, CONF_ID, CONF_LEVEL
from esphomeyaml.helpers import add, esphomelib_ns, get_variable, TemplateArguments, Pvariable, \
templatable, bool_
templatable, float_
PLATFORM_SCHEMA = cv.PLATFORM_SCHEMA.extend({
@@ -85,7 +85,7 @@ def output_turn_off_to_code(config, action_id, arg_type):
CONF_OUTPUT_SET_LEVEL = 'output.set_level'
OUTPUT_SET_LEVEL_ACTION = vol.Schema({
vol.Required(CONF_ID): cv.use_variable_id(None),
vol.Required(CONF_LEVEL): cv.percentage,
vol.Required(CONF_LEVEL): cv.templatable(cv.percentage),
})
@@ -97,7 +97,7 @@ def output_set_level_to_code(config, action_id, arg_type):
rhs = var.make_set_level_action(template_arg)
type = SetLevelAction.template(arg_type)
action = Pvariable(action_id, rhs, type=type)
for template_ in templatable(config[CONF_LEVEL], arg_type, bool_):
for template_ in templatable(config[CONF_LEVEL], arg_type, float_):
yield None
add(action.set_level(template_))
yield action