From 13cfe11a19991c4900e6e8a2e8a1c39936789f7c Mon Sep 17 00:00:00 2001 From: Paulus Schoutsen Date: Thu, 19 Jan 2023 15:28:28 -0500 Subject: [PATCH] Add upload dashboard api (#4318) --- esphome/dashboard/dashboard.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/esphome/dashboard/dashboard.py b/esphome/dashboard/dashboard.py index 0c12640a2e..8b8414c62c 100644 --- a/esphome/dashboard/dashboard.py +++ b/esphome/dashboard/dashboard.py @@ -305,6 +305,19 @@ class EsphomeRenameHandler(EsphomeCommandWebSocket): class EsphomeUploadHandler(EsphomeCommandWebSocket): + def build_command(self, json_message): + config_file = settings.rel_path(json_message["configuration"]) + return [ + "esphome", + "--dashboard", + "upload", + config_file, + "--device", + json_message["port"], + ] + + +class EsphomeRunHandler(EsphomeCommandWebSocket): def build_command(self, json_message): config_file = settings.rel_path(json_message["configuration"]) return [ @@ -1113,6 +1126,7 @@ def make_app(debug=get_bool_env(ENV_DEV)): (f"{rel}logout", LogoutHandler), (f"{rel}logs", EsphomeLogsHandler), (f"{rel}upload", EsphomeUploadHandler), + (f"{rel}run", EsphomeRunHandler), (f"{rel}compile", EsphomeCompileHandler), (f"{rel}validate", EsphomeValidateHandler), (f"{rel}clean-mqtt", EsphomeCleanMqttHandler),