Reset to AP mode ESP01

Hello all, I’m now to ESPhome and I’m converting one of my sensors to ESPhome… its super easy and works 100% except one feature that I used to have… I could press 2x reset switch and my ESP did reset to AP mode and forgot the client info… ( there is no other switch possible to attach, there are no spare pins :smiley: )

I used to have it like this:

#include <DoubleResetDetect.h>  //https://github.com/jenscski/DoubleResetDetect
// Number of seconds after reset during which a
// subseqent reset will be considered a double reset.
#define DRD_TIMEOUT 10
// RTC Memory Address for the DoubleResetDetector to use
#define DRD_ADDRESS 0x00
DoubleResetDetect drd(DRD_TIMEOUT, DRD_ADDRESS);

void setup() {
.
.
.
    if (drd.detect()) {
      Serial.println("Double Reset Detected");
      wifiManager.resetSettings();
    }

}

Any idea how can I integrate it to esphome firmware ?

In your case, on double click.