mirror of
https://github.com/esphome/esphome.git
synced 2025-09-10 15:22:24 +01:00
GPIO Switch Power On Value v2 (#183)
This commit is contained in:
@@ -5,10 +5,10 @@ from esphomeyaml.components import switch
|
||||
from esphomeyaml.const import CONF_MAKE_ID, CONF_NAME, CONF_OUTPUT
|
||||
from esphomeyaml.helpers import App, Application, get_variable, variable
|
||||
|
||||
MakeSimpleSwitch = Application.MakeSimpleSwitch
|
||||
MakeOutputSwitch = Application.MakeOutputSwitch
|
||||
|
||||
PLATFORM_SCHEMA = cv.nameable(switch.SWITCH_PLATFORM_SCHEMA.extend({
|
||||
cv.GenerateID(CONF_MAKE_ID): cv.declare_variable_id(MakeSimpleSwitch),
|
||||
cv.GenerateID(CONF_MAKE_ID): cv.declare_variable_id(MakeOutputSwitch),
|
||||
vol.Required(CONF_OUTPUT): cv.use_variable_id(None),
|
||||
}))
|
||||
|
||||
@@ -17,9 +17,9 @@ def to_code(config):
|
||||
output = None
|
||||
for output in get_variable(config[CONF_OUTPUT]):
|
||||
yield
|
||||
rhs = App.make_simple_switch(config[CONF_NAME], output)
|
||||
rhs = App.make_output_switch(config[CONF_NAME], output)
|
||||
gpio = variable(config[CONF_MAKE_ID], rhs)
|
||||
switch.setup_switch(gpio.Pswitch_, gpio.Pmqtt, config)
|
||||
|
||||
|
||||
BUILD_FLAGS = '-DUSE_SIMPLE_SWITCH'
|
||||
BUILD_FLAGS = '-DUSE_OUTPUT_SWITCH'
|
||||
|
Reference in New Issue
Block a user