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

Automation API & Cleanup

This commit is contained in:
Otto Winter
2018-05-20 12:41:52 +02:00
parent 061798839d
commit 374ea7044c
75 changed files with 1554 additions and 730 deletions

View File

@@ -5,7 +5,7 @@ import voluptuous as vol
import esphomeyaml.config_validation as cv
from esphomeyaml import core
from esphomeyaml.const import CONF_PORT, CONF_JS_URL, CONF_CSS_URL, CONF_ID, ESP_PLATFORM_ESP32
from esphomeyaml.helpers import App, add, Pvariable
from esphomeyaml.helpers import App, add, Pvariable, esphomelib_ns
_LOGGER = logging.getLogger(__name__)
@@ -16,10 +16,12 @@ CONFIG_SCHEMA = vol.Schema({
vol.Optional(CONF_JS_URL): vol.Url,
})
WebServer = esphomelib_ns.WebServer
def to_code(config):
rhs = App.init_web_server(config.get(CONF_PORT))
web_server = Pvariable('WebServer', config[CONF_ID], rhs)
web_server = Pvariable(WebServer, config[CONF_ID], rhs)
if CONF_CSS_URL in config:
add(web_server.set_css_url(config[CONF_CSS_URL]))
if CONF_JS_URL in config: