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

Rotary Encoder

This commit is contained in:
Otto Winter
2018-05-17 19:57:55 +02:00
parent 4b9bb2b731
commit 19929fafa5
12 changed files with 126 additions and 77 deletions

View File

@@ -4,7 +4,7 @@ import esphomeyaml.config_validation as cv
from esphomeyaml import pins
from esphomeyaml.components import switch
from esphomeyaml.const import CONF_ID, CONF_NAME, CONF_PIN
from esphomeyaml.helpers import App, exp_gpio_output_pin, variable
from esphomeyaml.helpers import App, variable, gpio_output_pin_expression
PLATFORM_SCHEMA = switch.PLATFORM_SCHEMA.extend({
cv.GenerateID('gpio_switch'): cv.register_variable_id,
@@ -13,7 +13,7 @@ PLATFORM_SCHEMA = switch.PLATFORM_SCHEMA.extend({
def to_code(config):
rhs = App.make_gpio_switch(config[CONF_NAME], exp_gpio_output_pin(config[CONF_PIN]))
rhs = App.make_gpio_switch(config[CONF_NAME], gpio_output_pin_expression(config[CONF_PIN]))
gpio = variable('Application::MakeGPIOSwitch', config[CONF_ID], rhs)
switch.setup_switch(gpio.Pswitch_, config)
switch.setup_mqtt_switch(gpio.Pmqtt, config)