Skip to content

Commit 3d97506

Browse files
committed
setup code set only if not paired
1 parent a09fda5 commit 3d97506

2 files changed

Lines changed: 5 additions & 3 deletions

File tree

src/config.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ enum customLockActions
4444

4545
//Miscellaneous
4646
#define HOMEKEY_COLOR TAN
47-
#define SETUP_CODE "46637726" //code used for homekit setup
47+
#define SETUP_CODE "46637726" // HomeKit Setup Code (only for reference, has to be changed during WiFi Configuration or from WebUI)
4848
#define OTA_PWD "homespan-ota" //custom password for ota
4949
#define DEVICE_NAME "HK" //Device name
5050
#define HOMEKEY_ALWAYS_UNLOCK 0 // Flag indicating if a successful Homekey authentication should always set and publish the unlock state

src/main.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -900,8 +900,10 @@ void setupWeb() {
900900
}
901901
else if (!strcmp(p->name().c_str(), "hk-setupcode")) {
902902
if (strcmp(espConfig::miscConfig.setupCode.c_str(), p->value().c_str()) && p->value().length() == 8) {
903-
homeSpan.setPairingCode(p->value().c_str());
904-
espConfig::miscConfig.setupCode = p->value().c_str();
903+
if (homeSpan.controllerListBegin() == homeSpan.controllerListEnd()) {
904+
homeSpan.setPairingCode(p->value().c_str());
905+
espConfig::miscConfig.setupCode = p->value().c_str();
906+
}
905907
}
906908
}
907909
else if (!strcmp(p->name().c_str(), "control-pin")) {

0 commit comments

Comments
 (0)