From 7c30d6254e0ee2d9656525cd2345411522972ec4 Mon Sep 17 00:00:00 2001 From: Paulus Schoutsen Date: Sun, 8 May 2022 18:53:34 -0700 Subject: [PATCH] Add rename command handler (#3443) --- esphome/dashboard/dashboard.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/esphome/dashboard/dashboard.py b/esphome/dashboard/dashboard.py index af68f2ae08..b78d22cf7c 100644 --- a/esphome/dashboard/dashboard.py +++ b/esphome/dashboard/dashboard.py @@ -283,6 +283,18 @@ class EsphomeLogsHandler(EsphomeCommandWebSocket): ] +class EsphomeRenameHandler(EsphomeCommandWebSocket): + def build_command(self, json_message): + config_file = settings.rel_path(json_message["configuration"]) + return [ + "esphome", + "--dashboard", + "rename", + config_file, + json_message["newName"], + ] + + class EsphomeUploadHandler(EsphomeCommandWebSocket): def build_command(self, json_message): config_file = settings.rel_path(json_message["configuration"]) @@ -971,6 +983,7 @@ def make_app(debug=get_bool_env(ENV_DEV)): (f"{rel}devices", ListDevicesHandler), (f"{rel}import", ImportRequestHandler), (f"{rel}secret_keys", SecretKeysRequestHandler), + (f"{rel}rename", EsphomeRenameHandler), ], **app_settings, )