Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ By default, the following GPIOs are used (ESP32-C3 example):
### Web-Based Hardware Configuration
You do not need to recompile the firmware to change GPIO pins! A lightweight HTTP server runs natively on the device at port `8080` to allow runtime configuration.
1. Connect the ESP32 to your Wi-Fi network (or connect your phone to the provisioner SoftAP).
2. Open a web browser and navigate to `http://<device-ip>:8080`.
2. Open a web browser and navigate to `http://matter-lock.local:8080` (or `http://<device-ip>:8080`).
3. You can dynamically modify the SPI pins, the boot button, the relay pin, the status LED, and configure the **Relay Active Level** (High/Low) to match your physical relay logic.
4. Click "Save & Reboot" to apply the changes. Settings are persisted to NVS automatically.

Expand Down Expand Up @@ -110,15 +110,14 @@ cd provisioner
2. **Pair to Apple Home**: The device will broadcast a Wi-Fi AP named `MatterLock-HomeKey`. Connect your iPhone to it.
3. Open the Apple Home app and add the accessory using the setup code `466-37-726`.
4. Wait for the Home app to generate the HomeKey in your Apple Wallet. The `pair_callback` will automatically extract the Apple Home Issuer Key and save it securely to NVS.
5. **Return to Matter**: Hold the BOOT button again for 3 seconds. The device will reboot back to the Matter runtime (`ota_0`).
5. **Return to Matter**: Once HomeKey provisioning succeeds, the device will automatically reboot back to the Matter runtime (`ota_0`). If you need to manually return to Matter without completing provisioning, you can hold the BOOT button again for 3 seconds.
6. Pair the lock into Apple Home *again*, this time using the printed Matter setup code.

## Roadmap & Future Enhancements

- **Secure Boot V2 & Flash Encryption:** Enabling hardware flash encryption to prevent physical extraction of Apple HomeKey cryptography certificates from NVS.
- **Deep Sleep Optimization:** Implement PN532 low-power IRQ wake-up or capacitive touch wake-up to minimize power draw for battery-operated deployments.
- **Matter Battery Cluster:** Expose the ESP32's ADC reading as a Matter Battery Level cluster for visibility in the Apple/Google Home app.
- **mDNS / Bonjour for Web Config:** Allow access to the configuration portal via a `.local` hostname instead of an IP address.
- **Dynamic Wi-Fi Provisioning:** Allow Wi-Fi credentials to be updated over BLE or the web portal without erasing NVS.
- **Custom PCB Design:** Provide a KiCad/EasyEDA design for a clean, jumper-free integration of the ESP32, Relay, and PN532.

Expand Down
2 changes: 1 addition & 1 deletion components/web_config/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
idf_component_register(SRCS "web_config.cpp"
INCLUDE_DIRS "include"
REQUIRES esp_http_server nvs_flash esp_timer driver mbedtls app_update)
REQUIRES esp_http_server nvs_flash esp_timer driver mbedtls app_update mdns)
12 changes: 12 additions & 0 deletions components/web_config/web_config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#include "driver/gpio.h"
#include "mbedtls/base64.h"
#include "esp_ota_ops.h"
#include <mdns.h>

static const char* TAG = "WebConfig";
static WebConfig* g_config = nullptr;
Expand Down Expand Up @@ -269,6 +270,17 @@ extern "C" esp_err_t web_config_server_start(WebConfig* config) {
httpd_register_uri_handler(server, &reboot0_uri);

ESP_LOGI(TAG, "Web Config Server started on port 8080");

// Initialize mDNS for Web Config
esp_err_t err = mdns_init();
if (err == ESP_OK || err == ESP_ERR_INVALID_STATE) {
mdns_hostname_set("matter-lock");
mdns_instance_name_set("Matter Lock Web Config");
mdns_service_add("Web Config", "_http", "_tcp", 8080, NULL, 0);
ESP_LOGI(TAG, "mDNS initialized, access via http://matter-lock.local:8080");
} else {
ESP_LOGW(TAG, "mDNS failed to initialize: %d", err);
}
} else {
ESP_LOGE(TAG, "Failed to start Web Config Server");
}
Expand Down
Loading