From 2118a9bee1a0af41aaadd38a91945701ef8bdee1 Mon Sep 17 00:00:00 2001 From: bullshit Date: Fri, 8 Aug 2025 18:52:19 +0200 Subject: [PATCH] chore: small improvements Signed-off-by: bullshit --- .devcontainer/devcontainer.json | 2 +- .devcontainer/setup.sh | 2 +- README.md | 2 +- tools/README.md | 15 ++++++++++++--- 4 files changed, 15 insertions(+), 6 deletions(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 6b42941..1375ac7 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -35,7 +35,7 @@ "ms-vscode.cmake-tools", "esphome.esphome-vscode", "platformio.platformio-ide", - "ms-vscode.hexeditor" + "ms-vscode.vscode-serial-monitor" ], "settings": { "python.defaultInterpreterPath": "/usr/local/bin/python", diff --git a/.devcontainer/setup.sh b/.devcontainer/setup.sh index 947f027..13baad3 100755 --- a/.devcontainer/setup.sh +++ b/.devcontainer/setup.sh @@ -11,7 +11,7 @@ pip install --upgrade esphome # Claude Code - MCP server sudo -u esphome bash -c "curl -fsSL https://claude.ai/install.sh | bash -s latest" -sudo -u esphome bash -c "~/.local/bin/claude mcp add code npx \"@steipete/claude-code-mcp\" \"/workspace\"" +sudo -u esphome bash -c "/home/esphome/.local/bin/claude mcp add code npx \"@steipete/claude-code-mcp\" \"/workspace\"" # Set up USB permissions cat > /etc/udev/rules.d/99-esphome-usb.rules << 'UDEV_EOF' diff --git a/README.md b/README.md index e12c4eb..914b846 100644 --- a/README.md +++ b/README.md @@ -111,7 +111,7 @@ tools/ └── README.md # Tools documentation .vscode/ -└── tasks.json # VSCode development tasks +├── tasks.json # VSCode development tasks ``` ### Development Tools diff --git a/tools/README.md b/tools/README.md index a06fd3b..b66b8df 100644 --- a/tools/README.md +++ b/tools/README.md @@ -1,10 +1,12 @@ # Development Tools -This folder contains development tools for the UPS HID ESPHome component. +This folder contains development tools for ESP32 ESPHome component development, including debugging utilities and vendor management tools. -## scan-usb.sh +## USB Device Management -This script lists esp and ups releated usb devices. +### scan-usb.sh + +Lists ESP32, UPS, and related USB devices connected to the system. Useful for identifying device paths and vendor/product IDs during development. ## generate_vendor_list.py @@ -13,6 +15,7 @@ This script keeps the UPS vendor ID lists synchronized between C++, scripts and ### Purpose The UPS HID component maintains a list of known UPS vendor IDs in two places: + - `components/ups_hid/ups_vendors.h` (C++ runtime code) - `components/ups_hid/__init__.py` (Python configuration validation) @@ -21,12 +24,14 @@ This script extracts the vendor list from the C++ header file and updates the Py ### Usage #### Command Line + ```bash cd /workspace python3 tools/generate_vendor_list.py ``` #### VSCode Task + 1. Open the Command Palette (`Ctrl+Shift+P` or `Cmd+Shift+P`) 2. Type "Tasks: Run Task" 3. Select "Generate UPS Vendor List" @@ -36,6 +41,7 @@ Or use the keyboard shortcut `Ctrl+Shift+P` -> "Tasks: Run Build Task" and selec ### When to Run Run this script whenever you: + 1. Add new UPS vendor IDs to `components/ups_hid/ups_vendors.h` 2. Modify existing vendor information 3. Want to ensure the C++ and Python lists are synchronized @@ -43,6 +49,7 @@ Run this script whenever you: ### Output The script will: + - Parse the C++ header file for vendor definitions - Extract vendor IDs, names, and descriptions - Update the `KNOWN_VENDOR_IDS` dictionary in `__init__.py` @@ -62,9 +69,11 @@ To add a new UPS vendor: 1. Edit `components/ups_hid/ups_vendors.h` 2. Add a new entry to the `KNOWN_UPS_VENDORS` array: + ```cpp {0x1234, "New Vendor", "New Vendor Description"}, ``` + 3. Run the generate_vendor_list.py script to update the Python file 4. Compile and test the component