From 2f05acfa5af5438e0046d74b99c384834462401a Mon Sep 17 00:00:00 2001 From: Otto Winter Date: Sun, 3 Jun 2018 12:16:43 +0200 Subject: [PATCH] Validate configuration button --- esphomeyaml/dashboard/dashboard.py | 8 ++ esphomeyaml/dashboard/templates/index.html | 95 +++++++++++++++++++--- 2 files changed, 92 insertions(+), 11 deletions(-) diff --git a/esphomeyaml/dashboard/dashboard.py b/esphomeyaml/dashboard/dashboard.py index 92d8b765bb..3b84be78ee 100644 --- a/esphomeyaml/dashboard/dashboard.py +++ b/esphomeyaml/dashboard/dashboard.py @@ -96,6 +96,13 @@ class EsphomeyamlCompileHandler(EsphomeyamlCommandWebSocket): return ["esphomeyaml", config_file, "compile"] +class EsphomeyamlValidateHandler(EsphomeyamlCommandWebSocket): + def build_command(self, message): + js = json.loads(message) + config_file = os.path.join(CONFIG_DIR, js['configuration']) + return ["esphomeyaml", config_file, "config"] + + class SerialPortRequestHandler(tornado.web.RequestHandler): def get(self): ports = get_serial_ports() @@ -161,6 +168,7 @@ def make_app(debug=False): (r"/logs", EsphomeyamlLogsHandler), (r"/run", EsphomeyamlRunHandler), (r"/compile", EsphomeyamlCompileHandler), + (r"/validate", EsphomeyamlValidateHandler), (r"/download.bin", DownloadBinaryRequestHandler), (r"/serial-ports", SerialPortRequestHandler), (r"/wizard.html", WizardRequestHandler), diff --git a/esphomeyaml/dashboard/templates/index.html b/esphomeyaml/dashboard/templates/index.html index 4cbfc1f565..b512174dec 100644 --- a/esphomeyaml/dashboard/templates/index.html +++ b/esphomeyaml/dashboard/templates/index.html @@ -207,6 +207,7 @@ Upload Compile Show Logs + Validate @@ -252,6 +253,18 @@ + +