Addressable updates

This commit is contained in:
Otto Winter
2019-04-25 10:36:55 +02:00
parent 766f6c045d
commit 595dfe7e24
13 changed files with 193 additions and 41 deletions
+9
View File
@@ -8,6 +8,7 @@ script_ns = cg.esphome_ns.namespace('script')
Script = script_ns.class_('Script', automation.Trigger.template())
ScriptExecuteAction = script_ns.class_('ScriptExecuteAction', automation.Action)
ScriptStopAction = script_ns.class_('ScriptStopAction', automation.Action)
IsRunningCondition = script_ns.class_('IsRunningCondition', automation.Condition)
CONFIG_SCHEMA = automation.validate_automation({
cv.Required(CONF_ID): cv.declare_id(Script),
@@ -34,3 +35,11 @@ def script_execute_action_to_code(config, action_id, template_arg, args):
def script_stop_action_to_code(config, action_id, template_arg, args):
paren = yield cg.get_variable(config[CONF_ID])
yield cg.new_Pvariable(action_id, template_arg, paren)
@automation.register_condition('script.is_running', IsRunningCondition, automation.maybe_simple_id({
cv.Required(CONF_ID): cv.use_id(Script)
}))
def script_is_running_to_code(config, condition_id, template_arg, args):
paren = yield cg.get_variable(config[CONF_ID])
yield cg.new_Pvariable(condition_id, template_arg, paren)