Skip to content

Commit

Permalink
Add VSCode dev tasks (#107)
Browse files Browse the repository at this point in the history
  • Loading branch information
tetele authored Jan 15, 2025
1 parent 7f5654b commit e890b26
Show file tree
Hide file tree
Showing 2 changed files with 73 additions and 2 deletions.
6 changes: 4 additions & 2 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -32,7 +32,9 @@
// yaml
"redhat.vscode-yaml",
// editorconfig
"editorconfig.editorconfig"
"editorconfig.editorconfig",
// shellcommand.execute
"augustocdias.tasks-shell-input"
],
"settings": {
"editor.formatOnPaste": false,
Expand Down
69 changes: 69 additions & 0 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -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"
}
}
]
}

0 comments on commit e890b26

Please sign in to comment.