From 70206df8b5dfd49118c0dbc47421bc317e25cabb Mon Sep 17 00:00:00 2001 From: Otto Winter Date: Sat, 20 Oct 2018 18:26:44 +0200 Subject: [PATCH 1/8] Fix gitlab --- .gitlab-ci.yml | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 684388971d..c62c4ae68d 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -208,15 +208,15 @@ deploy-beta:amd64: .deploy-pypi: &deploy-pypi stage: deploy - before_script: - - pip install -e . - - pip install twine - script: - - python setup.py sdist - - twine upload dist/* - tags: - - python2.7 - - esphomeyaml-test + before_script: + - pip install -e . + - pip install twine + script: + - python setup.py sdist + - twine upload dist/* + tags: + - python2.7 + - esphomeyaml-test deploy-release:pypi: <<: *deploy-pypi From 21c22fe04a3c114562bf1528650678a097e4481d Mon Sep 17 00:00:00 2001 From: Otto Winter Date: Sat, 20 Oct 2018 18:32:06 +0200 Subject: [PATCH 2/8] Bump version to 1.10.0-dev --- esphomeyaml/const.py | 6 +++--- esphomeyaml/core_config.py | 4 +++- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/esphomeyaml/const.py b/esphomeyaml/const.py index 1b09e18390..1858110a7c 100644 --- a/esphomeyaml/const.py +++ b/esphomeyaml/const.py @@ -1,11 +1,11 @@ """Constants used by esphomeyaml.""" MAJOR_VERSION = 1 -MINOR_VERSION = 9 -PATCH_VERSION = '0b1' +MINOR_VERSION = 10 +PATCH_VERSION = '0-dev' __short_version__ = '{}.{}'.format(MAJOR_VERSION, MINOR_VERSION) __version__ = '{}.{}'.format(__short_version__, PATCH_VERSION) -ESPHOMELIB_VERSION = '1.9.0b1' +ESPHOMELIB_VERSION = 'dev' ESP_PLATFORM_ESP32 = 'ESP32' ESP_PLATFORM_ESP8266 = 'ESP8266' diff --git a/esphomeyaml/core_config.py b/esphomeyaml/core_config.py index b236d7cb2b..57f15f751b 100644 --- a/esphomeyaml/core_config.py +++ b/esphomeyaml/core_config.py @@ -46,6 +46,8 @@ def validate_board(value): def validate_simple_esphomelib_version(value): value = cv.string_strict(value) if value.upper() == 'LATEST': + if ESPHOMELIB_VERSION == 'dev': + return validate_simple_esphomelib_version('dev') return { CONF_REPOSITORY: LIBRARY_URI_REPO, CONF_TAG: 'v' + ESPHOMELIB_VERSION, @@ -53,7 +55,7 @@ def validate_simple_esphomelib_version(value): elif value.upper() == 'DEV': return { CONF_REPOSITORY: LIBRARY_URI_REPO, - CONF_BRANCH: 'master' + CONF_BRANCH: 'dev' } elif VERSION_REGEX.match(value) is not None: return { From af4e2bf61d0b1ed049e4cad50891a688879c816f Mon Sep 17 00:00:00 2001 From: Otto Winter Date: Fri, 26 Oct 2018 22:57:03 +0200 Subject: [PATCH 3/8] Add Stepper Motor Support (#206) * Add stepper support * Fix output set_level * Lint --- esphomeyaml/components/output/__init__.py | 6 +- esphomeyaml/components/stepper/__init__.py | 126 +++++++++++++++++++++ esphomeyaml/components/stepper/a4988.py | 35 ++++++ esphomeyaml/const.py | 8 ++ esphomeyaml/helpers.py | 1 + tests/test1.yaml | 29 +++++ 6 files changed, 202 insertions(+), 3 deletions(-) create mode 100644 esphomeyaml/components/stepper/__init__.py create mode 100644 esphomeyaml/components/stepper/a4988.py diff --git a/esphomeyaml/components/output/__init__.py b/esphomeyaml/components/output/__init__.py index 33e275dd34..3cf0bd6e94 100644 --- a/esphomeyaml/components/output/__init__.py +++ b/esphomeyaml/components/output/__init__.py @@ -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 diff --git a/esphomeyaml/components/stepper/__init__.py b/esphomeyaml/components/stepper/__init__.py new file mode 100644 index 0000000000..3b5092d5cd --- /dev/null +++ b/esphomeyaml/components/stepper/__init__.py @@ -0,0 +1,126 @@ +import voluptuous as vol + +from esphomeyaml.automation import ACTION_REGISTRY +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 + +PLATFORM_SCHEMA = cv.PLATFORM_SCHEMA.extend({ + +}) + +# pylint: disable=invalid-name +stepper_ns = esphomelib_ns.namespace('stepper') +Stepper = stepper_ns.Stepper + +SetTargetAction = stepper_ns.SetTargetAction +ReportPositionAction = stepper_ns.ReportPositionAction + + +def validate_acceleration(value): + value = cv.string(value) + for suffix in ('steps/s^2', 'steps/s*s', 'steps/s/s', 'steps/ss', 'steps/(s*s)'): + if value.endswith(suffix): + value = value[:-len(suffix)] + + if value == 'inf': + return 1e6 + + try: + value = float(value) + except ValueError: + raise vol.Invalid("Expected acceleration as floating point number, got {}".format(value)) + + if value <= 0: + raise vol.Invalid("Acceleration must be larger than 0 steps/s^2!") + + return value + + +def validate_speed(value): + value = cv.string(value) + for suffix in ('steps/s', 'steps/s'): + if value.endswith(suffix): + value = value[:-len(suffix)] + + if value == 'inf': + return 1e6 + + try: + value = float(value) + except ValueError: + raise vol.Invalid("Expected speed as floating point number, got {}".format(value)) + + if value <= 0: + raise vol.Invalid("Speed must be larger than 0 steps/s!") + + return 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, +}) + +STEPPER_PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend(STEPPER_SCHEMA.schema) + + +def setup_stepper_core_(stepper_var, config): + if CONF_ACCELERATION in config: + add(stepper_var.set_acceleration(config[CONF_ACCELERATION])) + if CONF_DECELERATION in config: + add(stepper_var.set_deceleration(config[CONF_DECELERATION])) + if CONF_MAX_SPEED in config: + add(stepper_var.set_max_speed(config[CONF_MAX_SPEED])) + + +def setup_stepper(stepper_var, config): + add_job(setup_stepper_core_, stepper_var, config) + + +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_TARGET): cv.templatable(cv.int_), +}) + + +@ACTION_REGISTRY.register(CONF_STEPPER_SET_TARGET, STEPPER_SET_TARGET_ACTION_SCHEMA) +def stepper_set_target_to_code(config, action_id, arg_type): + template_arg = TemplateArguments(arg_type) + for var in get_variable(config[CONF_ID]): + yield None + rhs = var.make_set_target_action(template_arg) + type = SetTargetAction.template(arg_type) + action = Pvariable(action_id, rhs, type=type) + for template_ in templatable(config[CONF_TARGET], arg_type, int32): + yield None + add(action.set_target(template_)) + yield action + + +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_POSITION): cv.templatable(cv.int_), +}) + + +@ACTION_REGISTRY.register(CONF_STEPPER_REPORT_POSITION, STEPPER_REPORT_POSITION_ACTION_SCHEMA) +def stepper_report_position_to_code(config, action_id, arg_type): + template_arg = TemplateArguments(arg_type) + for var in get_variable(config[CONF_ID]): + yield None + rhs = var.make_report_position_action(template_arg) + type = ReportPositionAction.template(arg_type) + action = Pvariable(action_id, rhs, type=type) + for template_ in templatable(config[CONF_POSITION], arg_type, int32): + yield None + add(action.set_target(template_)) + yield action diff --git a/esphomeyaml/components/stepper/a4988.py b/esphomeyaml/components/stepper/a4988.py new file mode 100644 index 0000000000..e14d4a4a5b --- /dev/null +++ b/esphomeyaml/components/stepper/a4988.py @@ -0,0 +1,35 @@ +import voluptuous as vol + +from esphomeyaml import pins +from esphomeyaml.components import stepper +import esphomeyaml.config_validation as cv +from esphomeyaml.const import CONF_DIR_PIN, CONF_ID, CONF_SLEEP_PIN, CONF_STEP_PIN +from esphomeyaml.helpers import App, Pvariable, add, gpio_output_pin_expression + +A4988 = stepper.stepper_ns.A4988 + +PLATFORM_SCHEMA = stepper.STEPPER_PLATFORM_SCHEMA.extend({ + vol.Required(CONF_ID): cv.declare_variable_id(A4988), + vol.Required(CONF_STEP_PIN): pins.gpio_output_pin_schema, + vol.Required(CONF_DIR_PIN): pins.gpio_output_pin_schema, + vol.Optional(CONF_SLEEP_PIN): pins.gpio_output_pin_schema, +}) + + +def to_code(config): + for step_pin in gpio_output_pin_expression(config[CONF_STEP_PIN]): + yield + for dir_pin in gpio_output_pin_expression(config[CONF_DIR_PIN]): + yield + rhs = App.make_a4988(step_pin, dir_pin) + a4988 = Pvariable(config[CONF_ID], rhs) + + if CONF_SLEEP_PIN in config: + for sleep_pin in gpio_output_pin_expression(config[CONF_SLEEP_PIN]): + yield + add(a4988.set_sleep_pin(sleep_pin)) + + stepper.setup_stepper(a4988, config) + + +BUILD_FLAGS = '-DUSE_A4988' diff --git a/esphomeyaml/const.py b/esphomeyaml/const.py index 1858110a7c..539e0e4ba0 100644 --- a/esphomeyaml/const.py +++ b/esphomeyaml/const.py @@ -350,6 +350,14 @@ CONF_ARGS = 'args' CONF_FORMAT = 'format' CONF_COLOR_CORRECT = 'color_correct' CONF_ON_JSON_MESSAGE = 'on_json_message' +CONF_ACCELERATION = 'acceleration' +CONF_DECELERATION = 'deceleration' +CONF_MAX_SPEED = 'max_speed' +CONF_TARGET = 'target' +CONF_POSITION = 'position' +CONF_STEP_PIN = 'step_pin' +CONF_DIR_PIN = 'dir_pin' +CONF_SLEEP_PIN = 'sleep_pin' ALLOWED_NAME_CHARS = u'abcdefghijklmnopqrstuvwxyz0123456789_' ARDUINO_VERSION_ESP32_DEV = 'https://github.com/platformio/platform-espressif32.git#feature/stage' diff --git a/esphomeyaml/helpers.py b/esphomeyaml/helpers.py index 3f517fdce2..6ef894bdfe 100644 --- a/esphomeyaml/helpers.py +++ b/esphomeyaml/helpers.py @@ -565,6 +565,7 @@ std_string = std_ns.string uint8 = global_ns.namespace('uint8_t') uint16 = global_ns.namespace('uint16_t') uint32 = global_ns.namespace('uint32_t') +int32 = global_ns.namespace('int32_t') const_char_p = global_ns.namespace('const char *') NAN = global_ns.namespace('NAN') esphomelib_ns = global_ns # using namespace esphomelib; diff --git a/tests/test1.yaml b/tests/test1.yaml index 6961bd2598..d25abda030 100644 --- a/tests/test1.yaml +++ b/tests/test1.yaml @@ -797,6 +797,12 @@ switch: optimistic: True turn_on_action: - switch.turn_on: living_room_lights_on + - output.set_level: + id: gpio_19 + level: 50% + - output.set_level: + id: gpio_19 + level: !lambda 'return 0.5;' turn_off_action: - switch.turn_on: living_room_lights_off - platform: restart @@ -831,6 +837,19 @@ switch: - platform: uart name: "UART Bytes Output" data: [0xDE, 0xAD, 0xBE, 0xEF] + - platform: template + optimistic: true + name: Stepper Switch + turn_on_action: + - stepper.set_target: + id: my_stepper + target: !lambda |- + static int32_t i = 0; + i += 1000; + if (i > 5000) { + i = -5000; + } + return i; fan: - platform: binary @@ -941,3 +960,13 @@ pcf8574: - id: 'pcf8574_hub' address: 0x21 pcf8575: False + +stepper: +- platform: a4988 + id: my_stepper + step_pin: GPIO23 + dir_pin: GPIO24 + sleep_pin: GPIO25 + max_speed: 250 steps/s + acceleration: 100 steps/s^2 + deceleration: 200 steps/s^2 From 2fab7e73b91b8d4c965a4fe6aad5e19116d56d84 Mon Sep 17 00:00:00 2001 From: Otto Winter Date: Fri, 26 Oct 2018 22:59:03 +0200 Subject: [PATCH 4/8] Add send_first_at option to sliding window sensor filter (#207) * Add send_first_at option to sliding window sensor filter * Lint --- esphomeyaml/components/sensor/__init__.py | 20 ++++++++++++++++---- esphomeyaml/const.py | 1 + tests/test1.yaml | 1 + 3 files changed, 18 insertions(+), 4 deletions(-) diff --git a/esphomeyaml/components/sensor/__init__.py b/esphomeyaml/components/sensor/__init__.py index 01732ea1c6..dc12106135 100644 --- a/esphomeyaml/components/sensor/__init__.py +++ b/esphomeyaml/components/sensor/__init__.py @@ -7,7 +7,8 @@ from esphomeyaml.const import CONF_ABOVE, CONF_ACCURACY_DECIMALS, CONF_ALPHA, CO CONF_FILTER_NAN, CONF_FILTER_OUT, CONF_HEARTBEAT, CONF_ICON, CONF_ID, CONF_INTERNAL, \ CONF_LAMBDA, CONF_MQTT_ID, CONF_MULTIPLY, CONF_OFFSET, CONF_ON_RAW_VALUE, CONF_ON_VALUE, \ CONF_ON_VALUE_RANGE, CONF_OR, CONF_SEND_EVERY, CONF_SLIDING_WINDOW_MOVING_AVERAGE, \ - CONF_THROTTLE, CONF_TRIGGER_ID, CONF_UNIQUE, CONF_UNIT_OF_MEASUREMENT, CONF_WINDOW_SIZE + CONF_THROTTLE, CONF_TRIGGER_ID, CONF_UNIQUE, CONF_UNIT_OF_MEASUREMENT, CONF_WINDOW_SIZE, \ + CONF_SEND_FIRST_AT from esphomeyaml.helpers import App, ArrayInitializer, Pvariable, add, add_job, esphomelib_ns, \ float_, process_lambda, setup_mqtt_component, templatable @@ -20,6 +21,15 @@ def validate_recursive_filter(value): return FILTERS_SCHEMA(value) +def validate_send_first_at(value): + send_first_at = value.get(CONF_SEND_FIRST_AT) + send_every = value[CONF_SEND_EVERY] + if send_first_at is not None and send_first_at > send_every: + raise vol.Invalid("send_first_at must be smaller than or equal to send_every! {} <= {}" + "".format(send_first_at, send_every)) + return value + + FILTER_KEYS = [CONF_OFFSET, CONF_MULTIPLY, CONF_FILTER_OUT, CONF_FILTER_NAN, CONF_SLIDING_WINDOW_MOVING_AVERAGE, CONF_EXPONENTIAL_MOVING_AVERAGE, CONF_LAMBDA, CONF_THROTTLE, CONF_DELTA, CONF_UNIQUE, CONF_HEARTBEAT, CONF_DEBOUNCE, CONF_OR] @@ -29,10 +39,11 @@ FILTERS_SCHEMA = vol.All(cv.ensure_list, [vol.All({ vol.Optional(CONF_MULTIPLY): vol.Coerce(float), vol.Optional(CONF_FILTER_OUT): vol.Coerce(float), vol.Optional(CONF_FILTER_NAN): None, - vol.Optional(CONF_SLIDING_WINDOW_MOVING_AVERAGE): vol.Schema({ + vol.Optional(CONF_SLIDING_WINDOW_MOVING_AVERAGE): vol.All(vol.Schema({ vol.Required(CONF_WINDOW_SIZE): cv.positive_not_null_int, vol.Required(CONF_SEND_EVERY): cv.positive_not_null_int, - }), + vol.Optional(CONF_SEND_FIRST_AT): cv.positive_not_null_int, + }), validate_send_first_at), vol.Optional(CONF_EXPONENTIAL_MOVING_AVERAGE): vol.Schema({ vol.Required(CONF_ALPHA): cv.positive_float, vol.Required(CONF_SEND_EVERY): cv.positive_not_null_int, @@ -103,7 +114,8 @@ def setup_filter(config): yield FilterOutNANFilter.new() elif CONF_SLIDING_WINDOW_MOVING_AVERAGE in config: conf = config[CONF_SLIDING_WINDOW_MOVING_AVERAGE] - yield SlidingWindowMovingAverageFilter.new(conf[CONF_WINDOW_SIZE], conf[CONF_SEND_EVERY]) + yield SlidingWindowMovingAverageFilter.new(conf[CONF_WINDOW_SIZE], conf[CONF_SEND_EVERY], + conf.get(CONF_SEND_FIRST_AT)) elif CONF_EXPONENTIAL_MOVING_AVERAGE in config: conf = config[CONF_EXPONENTIAL_MOVING_AVERAGE] yield ExponentialMovingAverageFilter.new(conf[CONF_ALPHA], conf[CONF_SEND_EVERY]) diff --git a/esphomeyaml/const.py b/esphomeyaml/const.py index 539e0e4ba0..e289bd10a2 100644 --- a/esphomeyaml/const.py +++ b/esphomeyaml/const.py @@ -358,6 +358,7 @@ CONF_POSITION = 'position' CONF_STEP_PIN = 'step_pin' CONF_DIR_PIN = 'dir_pin' CONF_SLEEP_PIN = 'sleep_pin' +CONF_SEND_FIRST_AT = 'send_first_at' ALLOWED_NAME_CHARS = u'abcdefghijklmnopqrstuvwxyz0123456789_' ARDUINO_VERSION_ESP32_DEV = 'https://github.com/platformio/platform-espressif32.git#feature/stage' diff --git a/tests/test1.yaml b/tests/test1.yaml index d25abda030..9d7ca7cb8a 100644 --- a/tests/test1.yaml +++ b/tests/test1.yaml @@ -165,6 +165,7 @@ sensor: - sliding_window_moving_average: window_size: 15 send_every: 15 + send_first_at: 15 - exponential_moving_average: alpha: 0.1 send_every: 15 From 0ade9baf65eb9e2eff483f1abf5de8bb2238cf82 Mon Sep 17 00:00:00 2001 From: Otto Winter Date: Sat, 27 Oct 2018 14:10:37 +0200 Subject: [PATCH 5/8] Fix automation validation --- esphomeyaml/automation.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/esphomeyaml/automation.py b/esphomeyaml/automation.py index ee3a8113dc..c8dd9dab54 100644 --- a/esphomeyaml/automation.py +++ b/esphomeyaml/automation.py @@ -1,3 +1,5 @@ +import copy + import voluptuous as vol from esphomeyaml import core @@ -28,8 +30,9 @@ def validate_recursive_condition(value): def validate_recursive_action(value): - value = cv.ensure_list(value) + value = cv.ensure_list(value)[:] for i, item in enumerate(value): + item = copy.deepcopy(item) if not isinstance(item, dict): raise vol.Invalid(u"Action must consist of key-value mapping! Got {}".format(item)) key = next((x for x in item if x != CONF_ACTION_ID), None) From 08c16020c6709cb406fdd5f9853c788dcff520c0 Mon Sep 17 00:00:00 2001 From: Otto Winter Date: Mon, 29 Oct 2018 22:46:00 +0100 Subject: [PATCH 6/8] Fix output platforms --- esphomeyaml/components/output/__init__.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/esphomeyaml/components/output/__init__.py b/esphomeyaml/components/output/__init__.py index 3cf0bd6e94..403d22c6b4 100644 --- a/esphomeyaml/components/output/__init__.py +++ b/esphomeyaml/components/output/__init__.py @@ -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, float_ + templatable, float_, add_job PLATFORM_SCHEMA = cv.PLATFORM_SCHEMA.extend({ @@ -43,8 +43,7 @@ def setup_output_platform_(obj, config, skip_power_supply=False): def setup_output_platform(obj, config, skip_power_supply=False): - for _ in setup_output_platform_(obj, config, skip_power_supply): - yield + add_job(setup_output_platform_, obj, config, skip_power_supply) BUILD_FLAGS = '-DUSE_OUTPUT' From e9d9de448ef5e06eb66954018839a782ec709a83 Mon Sep 17 00:00:00 2001 From: Otto Winter Date: Wed, 31 Oct 2018 16:27:30 +0100 Subject: [PATCH 7/8] Fix output actions --- esphomeyaml/components/output/__init__.py | 36 +++++++++++------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/esphomeyaml/components/output/__init__.py b/esphomeyaml/components/output/__init__.py index 403d22c6b4..d4f6d27836 100644 --- a/esphomeyaml/components/output/__init__.py +++ b/esphomeyaml/components/output/__init__.py @@ -50,29 +50,13 @@ BUILD_FLAGS = '-DUSE_OUTPUT' CONF_OUTPUT_TURN_ON = 'output.turn_on' -OUTPUT_TURN_OFF_ACTION = maybe_simple_id({ +OUTPUT_TURN_ON_ACTION = maybe_simple_id({ vol.Required(CONF_ID): cv.use_variable_id(None), }) -@ACTION_REGISTRY.register(CONF_OUTPUT_TURN_ON, OUTPUT_TURN_OFF_ACTION) +@ACTION_REGISTRY.register(CONF_OUTPUT_TURN_ON, OUTPUT_TURN_ON_ACTION) def output_turn_on_to_code(config, action_id, arg_type): - template_arg = TemplateArguments(arg_type) - for var in get_variable(config[CONF_ID]): - yield None - rhs = var.make_turn_off_action(template_arg) - type = TurnOffAction.template(arg_type) - yield Pvariable(action_id, rhs, type=type) - - -CONF_OUTPUT_TURN_OFF = 'output.turn_off' -OUTPUT_TURN_ON_ACTION = maybe_simple_id({ - vol.Required(CONF_ID): cv.use_variable_id(None) -}) - - -@ACTION_REGISTRY.register(CONF_OUTPUT_TURN_OFF, OUTPUT_TURN_ON_ACTION) -def output_turn_off_to_code(config, action_id, arg_type): template_arg = TemplateArguments(arg_type) for var in get_variable(config[CONF_ID]): yield None @@ -81,6 +65,22 @@ def output_turn_off_to_code(config, action_id, arg_type): yield Pvariable(action_id, rhs, type=type) +CONF_OUTPUT_TURN_OFF = 'output.turn_off' +OUTPUT_TURN_OFF_ACTION = maybe_simple_id({ + vol.Required(CONF_ID): cv.use_variable_id(None) +}) + + +@ACTION_REGISTRY.register(CONF_OUTPUT_TURN_OFF, OUTPUT_TURN_OFF_ACTION) +def output_turn_off_to_code(config, action_id, arg_type): + template_arg = TemplateArguments(arg_type) + for var in get_variable(config[CONF_ID]): + yield None + rhs = var.make_turn_off_action(template_arg) + type = TurnOffAction.template(arg_type) + yield Pvariable(action_id, rhs, type=type) + + CONF_OUTPUT_SET_LEVEL = 'output.set_level' OUTPUT_SET_LEVEL_ACTION = vol.Schema({ vol.Required(CONF_ID): cv.use_variable_id(None), From 486174073b151a744066741b6fdcef5e9aa48a70 Mon Sep 17 00:00:00 2001 From: Otto Winter Date: Wed, 31 Oct 2018 16:34:03 +0100 Subject: [PATCH 8/8] Update .gitlab-ci.yml --- .gitlab-ci.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index c62c4ae68d..01c917866d 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -115,7 +115,7 @@ test2: - | docker tag \ "${CI_REGISTRY}/ottowinter/esphomeyaml-hassio-${ADDON_ARCH}:${CI_COMMIT_SHA}" \ - "${CI_REGISTRY}/ottowinter/esphomeyaml-hassio-${ADDON_ARCH}:beta" + "${CI_REGISTRY}/ottowinter/esphomeyaml-hassio-${ADDON_ARCH}:rc" - | docker tag \ "${CI_REGISTRY}/ottowinter/esphomeyaml-hassio-${ADDON_ARCH}:${CI_COMMIT_SHA}" \ @@ -123,10 +123,10 @@ test2: - | docker tag \ "ottowinter/esphomeyaml-hassio-${ADDON_ARCH}:${version}" \ - "ottowinter/esphomeyaml-hassio-${ADDON_ARCH}:beta" + "ottowinter/esphomeyaml-hassio-${ADDON_ARCH}:rc" - docker push "${CI_REGISTRY}/ottowinter/esphomeyaml-hassio-${ADDON_ARCH}:beta" - docker push "ottowinter/esphomeyaml-hassio-${ADDON_ARCH}:${version}" - - docker push "ottowinter/esphomeyaml-hassio-${ADDON_ARCH}:beta" + - docker push "ottowinter/esphomeyaml-hassio-${ADDON_ARCH}:rc" only: - /^v\d+\.\d+\.\d+b\d+$/ except: