From 168610f51e6aedc26e8a632a186e42d15afee128 Mon Sep 17 00:00:00 2001 From: tetele Date: Wed, 15 Jan 2025 14:52:51 +0000 Subject: [PATCH] Add VSCode dev tasks --- .devcontainer/devcontainer.json | 6 ++- .vscode/tasks.json | 69 +++++++++++++++++++++++++++++++++ 2 files changed, 73 insertions(+), 2 deletions(-) create mode 100644 .vscode/tasks.json diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index fe6cd4b..3448086 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -15,7 +15,7 @@ "-e", "ESPHOME_DASHBOARD_USE_PING=1" // uncomment and edit the path in order to pass though local USB serial to the conatiner - // , "--device=/dev/ttyACM0" + , "--device=/dev/ttyACM0" ], "appPort": 6052, // if you are using avahi in the host device, uncomment these to allow the @@ -32,7 +32,9 @@ // yaml "redhat.vscode-yaml", // editorconfig - "editorconfig.editorconfig" + "editorconfig.editorconfig", + // shellcommand.execute + "augustocdias.tasks-shell-input" ], "settings": { "editor.formatOnPaste": false, diff --git a/.vscode/tasks.json b/.vscode/tasks.json new file mode 100644 index 0000000..0e29a40 --- /dev/null +++ b/.vscode/tasks.json @@ -0,0 +1,69 @@ +{ + // See https://go.microsoft.com/fwlink/?LinkId=733558 + // for the documentation about the tasks.json format + "version": "2.0.0", + "tasks": [ + { + "label": "Run dashboard", + "type": "shell", + "command": "esphome", + "args": [ + "dashboard", + "/config" + ], + "problemMatcher": [] + }, + { + "label": "Compile current config", + "type": "shell", + "command": "esphome", + "args": [ + "compile", + "/config/${fileBasename}" + ], + "problemMatcher": [] + }, + { + "label": "Upload current config", + "type": "shell", + "command": "esphome", + "args": [ + "upload", + "--device", + "${input:serial_port}", + "/config/${fileBasename}" + ], + "problemMatcher": [] + }, + { + "label": "Upload current config and start logs", + "type": "shell", + "command": "esphome upload --device ${input:serial_port} /config/${fileBasename} && esphome logs --device ${input:serial_port} /config/${fileBasename}", + "problemMatcher": [] + }, + { + "label": "Start logs for current config", + "type": "shell", + "command": "esphome", + "args": [ + "logs", + "--device", + "${input:serial_port}", + "/config/${fileBasename}" + ], + "problemMatcher": [] + } + ], + "inputs": [ + { + "id": "serial_port", + "type": "command", + "command": "shellCommand.execute", + "args": { + // gets all handlers which match /dev/ttyACM* via sed 's/^\(.*\)\(/dev/tty.*\)$/\2/g' - + "command": "ls -la /dev/ttyACM* | sed 's/^\\(.*\\)\\(\\/dev\\/tty.*\\)$/\\2/g' -", + "description": "Select the USB port to upload to" + } + } + ] +}