Skip to content

Commit

Permalink
Merge pull request #580 from iranl/reboot-on-ble-stuck
Browse files Browse the repository at this point in the history
Reboot on BLE stuck disconnecting
  • Loading branch information
iranl authored Dec 27, 2024
2 parents e002c42 + 6fd0f38 commit 40aad37
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/nuki_ble
5 changes: 5 additions & 0 deletions src/NukiOpenerWrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4041,6 +4041,11 @@ void NukiOpenerWrapper::notify(Nuki::EventType eventType)
{
_preferences->putInt(preference_lock_pin_status, 2);
}
else if(eventType == Nuki::EventType::BLE_ERROR_ON_DISCONNECT)
{
Log->println("Error in disconnecting BLE client, rebooting");
restartEsp(RestartReason::BLEError);
}
}

void NukiOpenerWrapper::readConfig()
Expand Down
5 changes: 5 additions & 0 deletions src/NukiWrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4071,6 +4071,11 @@ void NukiWrapper::notify(Nuki::EventType eventType)
{
_preferences->putInt(preference_lock_pin_status, 2);
}
else if(eventType == Nuki::EventType::BLE_ERROR_ON_DISCONNECT)
{
Log->println("Error in disconnecting BLE client, rebooting");
restartEsp(RestartReason::BLEError);
}
}
}
}
Expand Down
3 changes: 3 additions & 0 deletions src/RestartReason.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ enum class RestartReason
{
RequestedViaMqtt,
RequestedViaWebServer,
BLEError,
BLEBeaconWatchdog,
RestartOnDisconnectWatchdog,
RestartIntervalWatchdog,
Expand Down Expand Up @@ -73,6 +74,8 @@ inline static String getRestartReason()
return "RequestedViaWebServer";
case RestartReason::ReconfigureWebServer:
return "ReconfigureWebServer";
case RestartReason::BLEError:
return "BLEError";
case RestartReason::BLEBeaconWatchdog:
return "BLEBeaconWatchdog";
case RestartReason::RestartOnDisconnectWatchdog:
Expand Down

0 comments on commit 40aad37

Please sign in to comment.