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

Let esphomeyaml know about class inheritance (#229)

* Allow overriding setup priority

* Add inheritance tree

* Global variables

* Tests and better validation

* Fix

* Lint
This commit is contained in:
Otto Winter
2018-11-12 23:30:31 +01:00
committed by GitHub
parent 4f375757a5
commit 15331edb78
128 changed files with 1572 additions and 989 deletions

View File

@@ -5,7 +5,7 @@ import esphomeyaml.config_validation as cv
from esphomeyaml.const import CONF_ACCELERATION, CONF_DECELERATION, CONF_ID, CONF_MAX_SPEED, \
CONF_POSITION, CONF_TARGET
from esphomeyaml.helpers import Pvariable, TemplateArguments, add, add_job, esphomelib_ns, \
get_variable, int32, templatable
get_variable, int32, templatable, Action
PLATFORM_SCHEMA = cv.PLATFORM_SCHEMA.extend({
@@ -13,10 +13,10 @@ PLATFORM_SCHEMA = cv.PLATFORM_SCHEMA.extend({
# pylint: disable=invalid-name
stepper_ns = esphomelib_ns.namespace('stepper')
Stepper = stepper_ns.Stepper
Stepper = stepper_ns.class_('Stepper')
SetTargetAction = stepper_ns.SetTargetAction
ReportPositionAction = stepper_ns.ReportPositionAction
SetTargetAction = stepper_ns.class_('SetTargetAction', Action)
ReportPositionAction = stepper_ns.class_('ReportPositionAction', Action)
def validate_acceleration(value):
@@ -60,7 +60,6 @@ def validate_speed(value):
STEPPER_SCHEMA = vol.Schema({
cv.GenerateID(): cv.declare_variable_id(Stepper),
vol.Required(CONF_MAX_SPEED): validate_speed,
vol.Optional(CONF_ACCELERATION): validate_acceleration,
vol.Optional(CONF_DECELERATION): validate_acceleration,
@@ -86,7 +85,7 @@ BUILD_FLAGS = '-DUSE_STEPPER'
CONF_STEPPER_SET_TARGET = 'stepper.set_target'
STEPPER_SET_TARGET_ACTION_SCHEMA = vol.Schema({
vol.Required(CONF_ID): cv.use_variable_id(None),
vol.Required(CONF_ID): cv.use_variable_id(Stepper),
vol.Required(CONF_TARGET): cv.templatable(cv.int_),
})
@@ -107,7 +106,7 @@ def stepper_set_target_to_code(config, action_id, arg_type):
CONF_STEPPER_REPORT_POSITION = 'stepper.report_position'
STEPPER_REPORT_POSITION_ACTION_SCHEMA = vol.Schema({
vol.Required(CONF_ID): cv.use_variable_id(None),
vol.Required(CONF_ID): cv.use_variable_id(Stepper),
vol.Required(CONF_POSITION): cv.templatable(cv.int_),
})