Captive portal flash option

Hi guys
I’m new here so I may miss something and there’s someone who will show me the correct way.
I’m trying to use captive portal but every time I restart my device all the inserted values are lost. Is there a way how to save it and use again?

I’m used to use C++ WifiManager class on ESP which can store data to onboard flash memory and reuse it again. I haven’t check it so may be wrong but it looks like the esphome WiFi implementation is based on the same library.

Plus one additional question:
Is there a way how to force captive portal on button press? I’m looking for it but it it looks like there’s no such action in WiFi module.

My device: ESP8266 Wemos D1 mini pro

Thank you

i’m looking for the same. any success here?

I suspect the reason no one answered the OP is it was very vague. Store what data? You can store additional wifi networks and passwords and many other configuration settings under wifi:
I have no idea why anyone would need a button to force captive portal. Why would you need or want an on-demand captive portal to change the network you want to use? If the device is portable, i could see that. If for some reason you do, you can store multiple networks under wifi: and have it connect to the one with the best signal or by setting the priority level for each one.

As far as data you enter into captive portal not saving to the device, it specifically talks about this in the docs and explains how to avoid it being erased when the board resets.

As far as forcing captive portal, im not sure about that one. You can make a template switch or in some action you can call the wifi.disable service. Captive portal is launched if no wifi connection can be made. Im not sure if disabling wifi meets thay condition and will launch captive portal but, you could easily try it and see.