Security: - Add verifyAPIRequest(): accepts valid Digest Auth (browser) OR valid HMAC-SHA256 signature (driver) — fixes browser UI being blocked by auth - All 11 API endpoints require verifyAPIRequest() - /register exempt (bootstrap handshake, secret not yet exchanged) - Credentials moved to secrets.h (gitignored); secrets.h.example added NTP: - Sync time on boot for HMAC replay-prevention timestamp window (±60s) - server.collectHeaders() registers X-Request-Time / X-Request-Sig NFC: - Full NFC access control: auth UID, relay trigger, absent timeout - Live UID display, copy-to-auth button, save/clear settings from UI - Access state: idle / granted / denied with colour feedback
ESP32-C6 Arduino Project
Arduino IDE project for ESP32-C6 Home Assistant integration.
Arduino IDE Setup
1. Install ESP32 Board Support
- Open Arduino IDE
- Go to File → Preferences
- Add this URL to "Additional Boards Manager URLs":
https://espressif.github.io/arduino-esp32/package_esp32_index.json - Go to Tools → Board → Boards Manager
- Search for "esp32" by Espressif Systems
- Install esp32 (version 3.0.0 or later for ESP32-C6 support)
2. Board Configuration
In Arduino IDE, select:
- Board: "ESP32C6 Dev Module"
- Upload Speed: 921600
- USB CDC On Boot: Enabled ⚠️ CRITICAL for serial output!
- Flash Size: 4MB
- Flash Mode: DIO
- Flash Frequency: 80MHz
- Partition Scheme: Default 4MB
- Port:
/dev/ttyACM0(ESP32-C6 typically uses ACM, not USB)
3. Open Project
- Open esp32_arduino.ino in Arduino IDE
- The IDE will create a folder with the same name automatically
4. Upload
- Connect your ESP32-C6 board via USB
- Check available ports:
ls -la /dev/ttyACM* /dev/ttyUSB* - Select the correct Port in Tools menu (usually
/dev/ttyACM0) - Click Upload button (→)
- Wait for compilation and upload
- Open Serial Monitor (Ctrl+Shift+M) and set to 115200 baud
- Press the RESET button on your board to see output
Important: If you see no serial output:
- Verify USB CDC On Boot is set to Enabled
- Press the physical RESET button on the board
- Make sure Serial Monitor is set to 115200 baud
WiFi Configuration
WiFi credentials are already set in the code:
const char* ssid = "Buon-Gusto_Nou";
const char* password = "arleta13";
Features
Web Interface
After upload, open your browser to the IP shown in Serial Monitor:
- Control panel with buttons
- Real-time status
- API documentation
REST API Endpoints
Get Device Status
curl http://<ESP32_IP>/api/status
Response:
{
"temperature": 25.3,
"wifi_rssi": -45,
"chip": "ESP32-C6",
"free_heap": 280000,
"uptime": 123,
"ip": "192.168.1.100",
"relay1": false,
"led": false
}
Control Relay
# Turn ON
curl -X POST http://<ESP32_IP>/api/relay/relay_1/on
# Turn OFF
curl -X POST http://<ESP32_IP>/api/relay/relay_1/off
# Get Status
curl http://<ESP32_IP>/api/relay/relay_1/status
Control LED
# Turn ON
curl -X POST http://<ESP32_IP>/api/led/led/on
# Turn OFF
curl -X POST http://<ESP32_IP>/api/led/led/off
GPIO Pins
- LED_PIN: GPIO 8 (onboard LED)
- RELAY_1_PIN: GPIO 2 (relay control)
Modify these in the code if your board uses different pins.
Troubleshooting
Board Not Found in Arduino IDE
- Make sure you installed ESP32 board support (minimum version 3.0.0)
- Restart Arduino IDE after installation
Upload Fails
- Check USB cable connection
- Select correct port in Tools → Port
- Try pressing BOOT button during upload
- Reduce upload speed to 115200
WiFi Connection Fails
- Verify SSID and password
- Check if WiFi is 2.4GHz (ESP32-C6 doesn't support 5GHz)
- Check Serial Monitor for connection messages
Can't See Serial Output
- Set Serial Monitor baud rate to 115200
- Enable "USB CDC On Boot" in board settings
- Some boards need GPIO 0 held LOW during boot to enter programming mode
Serial Monitor Output
Expected output after successful upload:
=================================
ESP32-C6 Home Assistant Device
=================================
GPIO initialized
Connecting to WiFi: Buon-Gusto_Nou
..........
✓ WiFi connected!
IP address: 192.168.1.100
RSSI: -45 dBm
MAC: AA:BB:CC:DD:EE:FF
✓ HTTP server started on port 80
=================================
Ready! Try these endpoints:
http://192.168.1.100/api/status
=================================
Next Steps
- Upload the code to your ESP32-C6
- Note the IP address from Serial Monitor
- Test the web interface in your browser
- Integrate with Home Assistant using the custom component at
../custom_components/olimex_esp32_c6/