I have an ESP32 set up and working with HAP-ESPHome, I have now built a second identical one but it is not found by the Apple Home App. It boots fine and the logs all all ok. I have tried different serial numbers and ID's but no luck. It does not even find the Bridge device for which I have specified config.
esphome:
name: esphome-web-58c298
friendly_name: NFC-LED-PAD
min_version: 2025.5.0
name_add_mac_suffix: false
esp32:
board: esp32dev
framework:
type: esp-idf
version: 5.2.1
platform_version: 6.7.0
sdkconfig_options:
CONFIG_MBEDTLS_HKDF_C: y
external_components:
- source: github://rednblkx/HAP-ESPHome@main
# Enable logging
logger:
level: DEBUG
# Enable Home Assistant API
api:
# Allow Over-The-Air updates
ota:
- platform: esphome
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
spi:
- id: spi_nfc
clk_pin: GPIO18
mosi_pin: GPIO23
miso_pin: GPIO19
pn532_spi:
cs_pin: 16
id: nfc_spi_module
update_interval: 100ms
spi_id: spi_nfc
on_tag:
then:
- lambda: |-
// Convert UID to string
auto uid = tag.get_uid();
char uid_str[24];
snprintf(uid_str, sizeof(uid_str), "%02X-%02X-%02X-%02X", uid[0], uid[1], uid[2], uid[3]);
ESP_LOGI("NFC", "Tag UID: %s", uid_str);
if (strcmp(uid_str, "04-BF-7D-05") == 0) {
ESP_LOGI("NFC", "✅ Auth success: known card");
id(hk_last_unlock_name).publish_state("Guest");
if (id(this_lock_reader1).state == LOCK_STATE_LOCKED) {
id(this_lock_reader1).unlock();
} else {
id(this_lock_reader1).lock();
}
} else {
ESP_LOGW("NFC", "⛔ Unknown card");
}
lock:
- platform: template
id: "this_lock_reader1"
name: "NFC Lock"
optimistic: True
on_lock:
- logger.log: "Door Locked!"
on_unlock:
- logger.log: "Door Unlocked!"
homekit_base:
meta:
name: "TEST2"
manufacturer: "TESTING"
model: "MAIN"
serial_number: "0000000"
fw_rev: "0.16.2.00"
setup_code: '159-35-739'
setup_id: "ES31"
homekit:
lock:
- id: this_lock_reader1
meta:
manufacturer: "None"
model: "NFC-Device"
serial_number: "00"
fw_rev: "0.00.0"
nfc_id: nfc_spi_module
on_hk_success:
then:
- lambda: |-
const std::string issuer = x.c_str();
ESP_LOGI("HEREHERE", "User IssuerID: %s", issuer.c_str());
ESP_LOGI("HEREHERE", "Device EndpointID: %s", y.c_str());
// Publish raw ID
id(hk_last_unlock_user).publish_state(issuer.c_str());
// Map to a friendly name
const char *name = "Unknown";
if (issuer == "d385403adbcfh1") {
name = "User 1";
} else if (issuer == "ABCDEF123456") {
name = "User 2";
} else if (issuer == "112233445566") {
name = " User 3";
}
id(hk_last_unlock_name).publish_state(name);
if (id(this_lock_reader1).state == LOCK_STATE_LOCKED) {
id(this_lock_reader1).unlock();
} else {
id(this_lock_reader1).lock();
}
on_hk_fail:
lambda: |-
ESP_LOGI("GSDGSGS", "IT FAILED :(");
hk_hw_finish: "SILVER"
button:
- platform: homekit_base
factory_reset:
name: "Reset Homekit pairings"
text_sensor:
# Raw issuer ID (optional but handy for debugging / adding new people)
- platform: template
name: "HK Last Unlock Issuer ID"
id: hk_last_unlock_user
icon: "mdi:key-alert"
update_interval: never
# Friendly name looked up from the issuer ID
- platform: template
name: "HK Last Unlock User"
id: hk_last_unlock_name
icon: "mdi:account-key"
update_interval: never
I have an ESP32 set up and working with HAP-ESPHome, I have now built a second identical one but it is not found by the Apple Home App. It boots fine and the logs all all ok. I have tried different serial numbers and ID's but no luck. It does not even find the Bridge device for which I have specified config.
Here is the config