Arduino Primo wifi switches back to AP mode when powered off

Juraj, I'm afraid I need more details to follow your advice.

I do not understand what "brick the esp8266 to block the AP" means. Tried to search but with no success.

I also looked at A Beginner's Guide to the ESP8266, which seemed to suggest ways to put in different modes, but the instruction to do Station mode and AP seemed identical (both used WiFi.begin the same way).

Also don't understand " put a sketch into esp8266, which turns off AP and has OTA support, for future experiments"

Also, please address problem with listen_service() function.