Add upload dashboard api (#4318)

This commit is contained in:
Paulus Schoutsen 2023-01-19 15:28:28 -05:00 committed by GitHub
parent 6d65671f92
commit 13cfe11a19
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 14 additions and 0 deletions

View File

@ -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),