Skip to content

Commit 2eee004

Browse files
limengducursoragent
andcommitted
feat: add BLE examples and update web flasher with WiFi/BLE categories
New BLE Examples: - XIAO_nRF52840_LowPowerMotionDetect: Ultra-low power motion detection with IMU wake-up for XIAO nRF52840 Sense - XIAO_ESP32_Series_BluetoothProxy: BLE-MQTT gateway supporting ESP32-C3/C5/C6/S3 with auto board detection Web Flasher Updates: - Split universal firmware into WiFi and BLE categories - Add BLE-MQTT Gateway firmware (multi-chip support) - Add new CSS styles for BLE section Build System: - Add build-bluetooth-proxy job with matrix for C3/C5/C6/S3 - Install WiFiManager and PubSubClient dependencies - Update release notes with BLE firmware section Documentation: - Update library READMEs with new examples - Update main READMEs with firmware categories - Add bilingual comments to all new code Co-authored-by: Cursor <cursoragent@cursor.com>
1 parent 2ad4969 commit 2eee004

14 files changed

Lines changed: 2400 additions & 31 deletions

File tree

.github/workflows/build-firmware.yml

Lines changed: 101 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ jobs:
4141
runs-on: ubuntu-latest
4242
outputs:
4343
library: ${{ steps.filter.outputs.library }}
44+
library-ble: ${{ steps.filter.outputs.library-ble }}
4445
iot-button: ${{ steps.filter.outputs.iot-button }}
4546
soil-moisture: ${{ steps.filter.outputs.soil-moisture }}
4647
camera-stream: ${{ steps.filter.outputs.camera-stream }}
@@ -51,6 +52,7 @@ jobs:
5152
led-switch: ${{ steps.filter.outputs.led-switch }}
5253
ha-state-subscribe: ${{ steps.filter.outputs.ha-state-subscribe }}
5354
temp-humidity: ${{ steps.filter.outputs.temp-humidity }}
55+
bluetooth-proxy: ${{ steps.filter.outputs.bluetooth-proxy }}
5456
steps:
5557
- uses: actions/checkout@v4
5658
- uses: dorny/paths-filter@v3
@@ -61,6 +63,10 @@ jobs:
6163
- 'arduino/SeeedHADiscovery/src/**'
6264
- 'arduino/SeeedHADiscovery/library.*'
6365
- '.github/workflows/build-firmware.yml'
66+
library-ble:
67+
- 'arduino/SeeedHADiscoveryBLE/src/**'
68+
- 'arduino/SeeedHADiscoveryBLE/library.*'
69+
- '.github/workflows/build-firmware.yml'
6470
iot-button:
6571
- 'arduino/SeeedHADiscovery/examples/IoTButtonV2_DeepSleep/**'
6672
soil-moisture:
@@ -81,6 +87,8 @@ jobs:
8187
- 'arduino/SeeedHADiscovery/examples/HAStateSubscribe/**'
8288
temp-humidity:
8389
- 'arduino/SeeedHADiscovery/examples/TemperatureHumidity/**'
90+
bluetooth-proxy:
91+
- 'arduino/SeeedHADiscoveryBLE/examples/XIAO_ESP32_Series_BluetoothProxy/**'
8492
8593
# ============================================================================
8694
# SEEED-SPECIFIC FIRMWARE | SEEED 专用固件
@@ -556,12 +564,69 @@ jobs:
556564
name: firmware-TemperatureHumidity-${{ matrix.chip }}
557565
path: build/TemperatureHumidity/${{ matrix.chip }}/
558566

567+
# ============================================================================
568+
# BLE UNIVERSAL FIRMWARE | BLE 通用固件
569+
# ============================================================================
570+
571+
# Bluetooth Proxy - BLE-MQTT Gateway (Multi-chip)
572+
build-bluetooth-proxy:
573+
needs: detect-changes
574+
if: ${{ github.event_name == 'workflow_dispatch' || needs.detect-changes.outputs.library-ble == 'true' || needs.detect-changes.outputs.bluetooth-proxy == 'true' }}
575+
runs-on: ubuntu-latest
576+
strategy:
577+
fail-fast: false
578+
matrix:
579+
include:
580+
- chip: C3
581+
fqbn: "esp32:esp32:XIAO_ESP32C3:CDCOnBoot=cdc,PartitionScheme=min_spiffs,FlashMode=qio,FlashSize=4M"
582+
family: "ESP32-C3"
583+
- chip: C5
584+
fqbn: "esp32:esp32:XIAO_ESP32C5:CDCOnBoot=cdc,PartitionScheme=min_spiffs,FlashMode=qio,FlashSize=8M"
585+
family: "ESP32-C5"
586+
- chip: C6
587+
fqbn: "esp32:esp32:XIAO_ESP32C6:CDCOnBoot=cdc,PartitionScheme=min_spiffs,FlashMode=qio,FlashSize=4M"
588+
family: "ESP32-C6"
589+
- chip: S3
590+
fqbn: "esp32:esp32:XIAO_ESP32S3:CDCOnBoot=cdc,PartitionScheme=min_spiffs,USBMode=hwcdc,FlashMode=qio,FlashSize=8M,PSRAM=opi"
591+
family: "ESP32-S3"
592+
steps:
593+
- uses: actions/checkout@v4
594+
- name: Setup and compile
595+
run: |
596+
curl -fsSL https://raw.githubusercontent.com/arduino/arduino-cli/master/install.sh | BINDIR=/usr/local/bin sh
597+
arduino-cli config init
598+
arduino-cli config add board_manager.additional_urls "https://espressif.github.io/arduino-esp32/package_esp32_index.json"
599+
arduino-cli core update-index
600+
arduino-cli core install esp32:esp32@${{ env.ESP32_CORE_VERSION }}
601+
# Install required libraries
602+
arduino-cli lib install "ArduinoJson@${{ env.ARDUINOJSON_VERSION }}"
603+
arduino-cli lib install "WiFiManager"
604+
arduino-cli lib install "PubSubClient"
605+
# Copy BLE library
606+
mkdir -p ~/Arduino/libraries && cp -r arduino/SeeedHADiscoveryBLE ~/Arduino/libraries/
607+
mkdir -p build/BluetoothProxy/${{ matrix.chip }}
608+
arduino-cli compile --fqbn "${{ matrix.fqbn }}" --output-dir "build/BluetoothProxy/${{ matrix.chip }}" --export-binaries \
609+
"arduino/SeeedHADiscoveryBLE/examples/XIAO_ESP32_Series_BluetoothProxy/XIAO_ESP32_Series_BluetoothProxy.ino"
610+
- name: Prepare firmware
611+
run: |
612+
cd build/BluetoothProxy/${{ matrix.chip }}
613+
for f in *.bin; do
614+
[[ "$f" == *".ino.bin" ]] && mv "$f" "firmware.bin"
615+
[[ "$f" == *".bootloader.bin" ]] && mv "$f" "bootloader.bin"
616+
[[ "$f" == *".partitions.bin" ]] && mv "$f" "partitions.bin"
617+
done
618+
cp $(find ~/.arduino15/packages/esp32 -name "boot_app0.bin" -type f | head -1) ./boot_app0.bin
619+
- uses: actions/upload-artifact@v4
620+
with:
621+
name: firmware-BluetoothProxy-${{ matrix.chip }}
622+
path: build/BluetoothProxy/${{ matrix.chip }}/
623+
559624
# ============================================================================
560625
# COMBINE & RELEASE | 合并与发布
561626
# ============================================================================
562627

563628
combine:
564-
needs: [detect-changes, build-iot-button, build-soil-moisture, build-camera-stream, build-reterminal-e1001, build-reterminal-e1002, build-wifi-provisioning, build-button-switch, build-led-switch, build-ha-state-subscribe, build-temp-humidity]
629+
needs: [detect-changes, build-iot-button, build-soil-moisture, build-camera-stream, build-reterminal-e1001, build-reterminal-e1002, build-wifi-provisioning, build-button-switch, build-led-switch, build-ha-state-subscribe, build-temp-humidity, build-bluetooth-proxy]
565630
if: always() && !cancelled()
566631
runs-on: ubuntu-latest
567632
steps:
@@ -584,7 +649,7 @@ jobs:
584649
fi
585650
done
586651
587-
# Multi-chip firmware (Universal) - create manifest with all chips
652+
# Multi-chip firmware (Universal WiFi) - create manifest with all chips
588653
for fw in WiFiProvisioning ButtonSwitch LEDSwitch HAStateSubscribe TemperatureHumidity; do
589654
mkdir -p "combined-firmware/${fw}"
590655
for chip in C3 C5 C6 S3; do
@@ -612,6 +677,34 @@ jobs:
612677
fi
613678
done
614679
680+
# Multi-chip firmware (Universal BLE) - create manifest with all chips
681+
for fw in BluetoothProxy; do
682+
mkdir -p "combined-firmware/${fw}"
683+
for chip in C3 C5 C6 S3; do
684+
if [ -d "all-firmware/firmware-${fw}-${chip}" ]; then
685+
mkdir -p "combined-firmware/${fw}/${chip}"
686+
cp -r "all-firmware/firmware-${fw}-${chip}/"* "combined-firmware/${fw}/${chip}/"
687+
echo "Added: ${fw}/${chip}"
688+
fi
689+
done
690+
691+
# Create multi-chip manifest
692+
if [ -d "combined-firmware/${fw}/C3" ] || [ -d "combined-firmware/${fw}/C5" ] || [ -d "combined-firmware/${fw}/C6" ] || [ -d "combined-firmware/${fw}/S3" ]; then
693+
echo '{"name":"BLE-MQTT Gateway","version":"1.0.0","new_install_prompt_erase":true,"builds":[' > "combined-firmware/${fw}/manifest.json"
694+
FIRST=true
695+
for chip in C3 C5 C6 S3; do
696+
if [ -d "combined-firmware/${fw}/${chip}" ]; then
697+
[ "$FIRST" = false ] && echo ',' >> "combined-firmware/${fw}/manifest.json"
698+
FIRST=false
699+
FAMILY="ESP32-${chip}"
700+
echo '{"chipFamily":"'"${FAMILY}"'","parts":[{"path":"'"${chip}"'/bootloader.bin","offset":0},{"path":"'"${chip}"'/partitions.bin","offset":32768},{"path":"'"${chip}"'/boot_app0.bin","offset":57344},{"path":"'"${chip}"'/firmware.bin","offset":65536}]}' >> "combined-firmware/${fw}/manifest.json"
701+
fi
702+
done
703+
echo ']}' >> "combined-firmware/${fw}/manifest.json"
704+
echo "Created manifest for ${fw}"
705+
fi
706+
done
707+
615708
echo ""
616709
echo "Final structure:"
617710
find combined-firmware -type f | head -50
@@ -667,7 +760,7 @@ jobs:
667760
| reTerminal_E1001 | reTerminal E1001 | E-Paper dashboard |
668761
| reTerminal_E1002 | reTerminal E1002 | Color E-Paper dashboard |
669762
670-
### 📦 Universal Firmware (Auto Chip Detection)
763+
### 📦 WiFi Universal Firmware (Auto Chip Detection)
671764
| Firmware | Supported Chips | Description |
672765
|----------|-----------------|-------------|
673766
| WiFiProvisioning | C3/C5/C6/S3 | WiFi setup demo |
@@ -676,6 +769,11 @@ jobs:
676769
| HAStateSubscribe | C3/C5/C6/S3 | HA state display |
677770
| TemperatureHumidity | C3/C5/C6/S3 | Sensor demo |
678771
772+
### 📦 BLE Universal Firmware (Auto Chip Detection)
773+
| Firmware | Supported Chips | Description |
774+
|----------|-----------------|-------------|
775+
| BluetoothProxy | C3/C5/C6/S3 | BLE-MQTT Gateway |
776+
679777
### 📝 Changelog
680778
${CHANGELOG}
681779

README.md

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -69,11 +69,12 @@ Click the button below to add this integration to your Home Assistant:
6969
| 🏷️ **Seeed Products** | XIAO Soil Moisture Sensor | ESP32-C6 |
7070
| 🏷️ **Seeed Products** | CameraStream | ESP32-S3 Sense |
7171
| 🏷️ **Seeed Products** | reTerminal E1001/E1002 | ESP32-S3 |
72-
| 🔧 **Universal** | WiFi Provisioning | C3/C5/C6/S3 |
73-
| 🔧 **Universal** | Button Switch | C3/C5/C6/S3 |
74-
| 🔧 **Universal** | LED Switch | C5/C6/S3 |
75-
| 🔧 **Universal** | HA State Subscribe | C3/C5/C6/S3 |
76-
| 🔧 **Universal** | Temperature & Humidity | C3/C5/C6/S3 |
72+
| 📶 **WiFi Universal** | WiFi Provisioning | C3/C5/C6/S3 |
73+
| 📶 **WiFi Universal** | Button Switch | C3/C5/C6/S3 |
74+
| 📶 **WiFi Universal** | LED Switch | C5/C6/S3 |
75+
| 📶 **WiFi Universal** | HA State Subscribe | C3/C5/C6/S3 |
76+
| 📶 **WiFi Universal** | Temperature & Humidity | C3/C5/C6/S3 |
77+
| 📡 **BLE Universal** | BLE-MQTT Gateway | C3/C5/C6/S3 |
7778

7879
> 💡 **Tip**: Universal firmware supports auto chip detection - just connect your XIAO board and click flash!
7980
@@ -637,7 +638,9 @@ seeed-ha-discovery/
637638
│ │ ├── TemperatureBLE/ # Temperature/Humidity sensor example (passive broadcast)
638639
│ │ ├── ButtonBLE/ # Button switch example (GATT bidirectional)
639640
│ │ ├── LEDSwitchBLE/ # LED switch example (GATT bidirectional)
640-
│ │ └── HAStateSubscribeBLE/ # HA state subscription example (v2.4 New)
641+
│ │ ├── HAStateSubscribeBLE/ # HA state subscription example (v2.4 New)
642+
│ │ ├── XIAO_nRF52840_LowPowerMotionDetect/ # Ultra-low power motion detection (nRF52840)
643+
│ │ └── XIAO_ESP32_Series_BluetoothProxy/ # BLE-MQTT Gateway (ESP32 series)
641644
│ ├── library.json
642645
│ └── library.properties
643646
├── hacs.json

README_CN.md

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -69,11 +69,12 @@
6969
| 🏷️ **Seeed 产品** | 土壤湿度传感器 | ESP32-C6 |
7070
| 🏷️ **Seeed 产品** | 摄像头推流 | ESP32-S3 Sense |
7171
| 🏷️ **Seeed 产品** | reTerminal E1001/E1002 | ESP32-S3 |
72-
| 🔧 **通用固件** | WiFi 配网 | C3/C5/C6/S3 |
73-
| 🔧 **通用固件** | 按钮开关 | C3/C5/C6/S3 |
74-
| 🔧 **通用固件** | LED 开关 | C5/C6/S3 |
75-
| 🔧 **通用固件** | HA 状态订阅 | C3/C5/C6/S3 |
76-
| 🔧 **通用固件** | 温湿度传感器 | C3/C5/C6/S3 |
72+
| 📶 **WiFi 通用** | WiFi 配网 | C3/C5/C6/S3 |
73+
| 📶 **WiFi 通用** | 按钮开关 | C3/C5/C6/S3 |
74+
| 📶 **WiFi 通用** | LED 开关 | C5/C6/S3 |
75+
| 📶 **WiFi 通用** | HA 状态订阅 | C3/C5/C6/S3 |
76+
| 📶 **WiFi 通用** | 温湿度传感器 | C3/C5/C6/S3 |
77+
| 📡 **蓝牙通用** | BLE-MQTT 网关 | C3/C5/C6/S3 |
7778

7879
> 💡 **提示**:通用固件支持自动芯片检测 - 只需连接你的 XIAO 开发板,点击烧录即可!
7980
@@ -637,7 +638,9 @@ seeed-ha-discovery/
637638
│ │ ├── TemperatureBLE/ # 温湿度传感器示例 (被动广播)
638639
│ │ ├── ButtonBLE/ # 按钮开关示例 (GATT 双向)
639640
│ │ ├── LEDSwitchBLE/ # LED 开关示例 (GATT 双向)
640-
│ │ └── HAStateSubscribeBLE/ # HA 状态订阅示例 (v2.4 新增)
641+
│ │ ├── HAStateSubscribeBLE/ # HA 状态订阅示例 (v2.4 新增)
642+
│ │ ├── XIAO_nRF52840_LowPowerMotionDetect/ # 超低功耗运动检测 (nRF52840)
643+
│ │ └── XIAO_ESP32_Series_BluetoothProxy/ # BLE-MQTT 网关 (ESP32 系列)
641644
│ ├── library.json
642645
│ └── library.properties
643646
├── hacs.json

arduino/SeeedHADiscovery.zip

-177 KB
Binary file not shown.

arduino/SeeedHADiscoveryBLE/README.md

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -171,12 +171,14 @@ void loop() {
171171

172172
## 📂 Examples
173173

174-
| Example | Description |
175-
|---------|-------------|
176-
| [TemperatureBLE](examples/TemperatureBLE/) | Basic sensor broadcast (BTHome) |
177-
| [ButtonBLE](examples/ButtonBLE/) | Button events via BLE |
178-
| [LEDSwitchBLE](examples/LEDSwitchBLE/) | Controllable LED via GATT |
179-
| [HAStateSubscribeBLE](examples/HAStateSubscribeBLE/) | Subscribe to HA entity states |
174+
| Example | Description | Platform |
175+
|---------|-------------|----------|
176+
| [TemperatureBLE](examples/TemperatureBLE/) | Basic sensor broadcast (BTHome) | ESP32 / nRF52840 |
177+
| [ButtonBLE](examples/ButtonBLE/) | Button events via BLE | ESP32 / nRF52840 |
178+
| [LEDSwitchBLE](examples/LEDSwitchBLE/) | Controllable LED via GATT | ESP32 / nRF52840 |
179+
| [HAStateSubscribeBLE](examples/HAStateSubscribeBLE/) | Subscribe to HA entity states | ESP32 / nRF52840 |
180+
| [XIAO_nRF52840_LowPowerMotionDetect](examples/XIAO_nRF52840_LowPowerMotionDetect/) | Ultra-low power motion detection with IMU wake-up | nRF52840 Sense |
181+
| [XIAO_ESP32_Series_BluetoothProxy](examples/XIAO_ESP32_Series_BluetoothProxy/) | BLE-MQTT Gateway, forward BTHome to MQTT | ESP32-C3/C5/C6/S3 |
180182

181183
## 🔌 API Reference
182184

arduino/SeeedHADiscoveryBLE/README_CN.md

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -171,12 +171,14 @@ void loop() {
171171

172172
## 📂 示例程序
173173

174-
| 示例 | 描述 |
175-
|------|------|
176-
| [TemperatureBLE](examples/TemperatureBLE/) | 基础传感器广播(BTHome) |
177-
| [ButtonBLE](examples/ButtonBLE/) | 通过 BLE 发送按钮事件 |
178-
| [LEDSwitchBLE](examples/LEDSwitchBLE/) | 通过 GATT 控制 LED |
179-
| [HAStateSubscribeBLE](examples/HAStateSubscribeBLE/) | 订阅 HA 实体状态 |
174+
| 示例 | 描述 | 平台 |
175+
|------|------|------|
176+
| [TemperatureBLE](examples/TemperatureBLE/) | 基础传感器广播(BTHome) | ESP32 / nRF52840 |
177+
| [ButtonBLE](examples/ButtonBLE/) | 通过 BLE 发送按钮事件 | ESP32 / nRF52840 |
178+
| [LEDSwitchBLE](examples/LEDSwitchBLE/) | 通过 GATT 控制 LED | ESP32 / nRF52840 |
179+
| [HAStateSubscribeBLE](examples/HAStateSubscribeBLE/) | 订阅 HA 实体状态 | ESP32 / nRF52840 |
180+
| [XIAO_nRF52840_LowPowerMotionDetect](examples/XIAO_nRF52840_LowPowerMotionDetect/) | 超低功耗运动检测,IMU 唤醒 | nRF52840 Sense |
181+
| [XIAO_ESP32_Series_BluetoothProxy](examples/XIAO_ESP32_Series_BluetoothProxy/) | BLE-MQTT 网关,转发 BTHome 到 MQTT | ESP32-C3/C5/C6/S3 |
180182

181183
## 🔌 API 参考
182184

0 commit comments

Comments
 (0)