1
0
mirror of https://github.com/esphome/esphome.git synced 2025-11-19 16:25:50 +00:00

Dashboard editor live validation (#540)

* Dashboard editor validation

* Improve range detection

* Lint
This commit is contained in:
Otto Winter
2019-05-11 11:41:09 +02:00
committed by GitHub
parent e373620393
commit a1a7448868
7 changed files with 134 additions and 19 deletions

View File

@@ -256,12 +256,12 @@ class EsphomeCommandWebSocket(tornado.websocket.WebSocketHandler):
self.write_message({'event': 'exit', 'code': returncode})
def on_close(self):
# Shutdown proc on WS close
self._is_closed = True
# Check if proc exists (if 'start' has been run)
if self.is_process_active:
_LOGGER.debug("Terminating process")
self._proc.proc.terminate()
# Shutdown proc on WS close
self._is_closed = True
def build_command(self, json_message):
raise NotImplementedError
@@ -310,6 +310,11 @@ class EsphomeVscodeHandler(EsphomeCommandWebSocket):
return ["esphome", "--dashboard", "-q", 'dummy', "vscode"]
class EsphomeAceEditorHandler(EsphomeCommandWebSocket):
def build_command(self, json_message):
return ["esphome", "--dashboard", "-q", settings.config_dir, "vscode", "--ace"]
class SerialPortRequestHandler(BaseHandler):
@authenticated
def get(self):
@@ -678,6 +683,7 @@ def make_app(debug=False):
(rel + "clean-mqtt", EsphomeCleanMqttHandler),
(rel + "clean", EsphomeCleanHandler),
(rel + "vscode", EsphomeVscodeHandler),
(rel + "ace", EsphomeAceEditorHandler),
(rel + "edit", EditRequestHandler),
(rel + "download.bin", DownloadBinaryRequestHandler),
(rel + "serial-ports", SerialPortRequestHandler),
@@ -723,7 +729,7 @@ def start_web_server(args):
webbrowser.open('localhost:{}'.format(args.port))
if settings.status_use_ping:
if not settings.status_use_ping:
status_thread = PingStatusThread()
else:
status_thread = MDNSStatusThread()