Skip to content

Releases: ESDN83/esp-ha-usb-gateway

v1.0.1 — Stability & Security Fixes

17 Apr 17:27

Choose a tag to compare

Bug fixes & hardening

Two rounds of stability and security fixes. All changes are backwards-compatible — safe drop-in upgrade from v1.0.0.

Round 1 — Thread safety, XSS, UX, performance (a9c00b3)

  • Thread safety: Replaced strtok with strtok_r in is_ip_allowed. strtok uses a static buffer and is not safe when the HTTP server handles concurrent requests.
  • XSS hardening: Device config inputs no longer build onclick handlers from unescaped user strings. Uses data-* attributes with event delegation instead.
  • UX — no more focus loss: Auto-refresh every 5s was re-rendering inputs and stealing focus while typing. Now skips re-render while the user is editing a config field.
  • Performance: Settings (password, IP allowlist) were read from NVS on every HTTP request. Now cached on the component and refreshed only when changed.

Round 2 — USB races, JSON robustness, FTDI accuracy (b534b52)

  • USB race — chip init: handle_new_device_ ran FTDI/CP210X/CDC-ACM init without holding usb_mutex. A disconnect during init could leave a half-initialized device. Now wrapped in a recursive mutex with a null-check bail-out.
  • USB race — cold-boot retry: client_hdl_ could be freed while another task used it. Fixed with null-first-then-deregister pattern.
  • JSON parser robustness: The minimal JSON parser broke on } characters inside strings and on escaped quotes. Added a brace-aware object-end finder and proper escape handling in json_get_str.
  • FTDI baud accuracy: Simple division produced wrong baud rates at non-standard speeds. Replaced with the Linux ftdi_sio fractional divisor algorithm (divfrac table, 48 MHz / 2 reference).

Compatibility

  • No config changes required.
  • No sensor/entity changes.
  • Tested on USB TCP bridge + EnOcean + Ethernet variant before merge.

Full changelog: v1.0.0...v1.0.1

v1.0.0 — Native ESPHome API, Per-Device Sensors

12 Apr 10:37

Choose a tag to compare

ESP HA USB Gateway v1.0.0

First stable release with native ESPHome API integration (no MQTT needed).

Features

  • USB Host on ESP32-S3 with auto-detection of FTDI, CP210X, CDC-ACM devices
  • Per-device sensors in Home Assistant (name, port, status per USB device)
  • Config URL and IP address sensors for automation
  • Web UI for device configuration (port assignment, baud rate, IP whitelist)
  • WiFi and Ethernet (Waveshare W5500) support
  • USB hub support (multi-level)
  • Visit button on HA device page
  • Restart button via HA

Supported Devices

  • SkyConnect v1.0 (CP210X)
  • Sonoff Zigbee 3.0 USB Dongle Plus V2 (CP210X)
  • EnOcean USB 300 (FTDI)
  • Generic FTDI/CP210X/CDC-ACM