Damien, my apologies, just don't have enough time right now. Hoping someone else has some ideas.
In the meantime, some thoughts to process:
I do see suspicious code L6 and L14 with the nested connect() function. Do you have an example or tutorial link that is being worked from?
I remember STA and AP mode being an issue for me and several were able to provide ideas that got me running with the 8266. These might give some ideas to try, until someone else is able to respond.
Also noticed function getPrice() isn't defined, maybe because of personal security, but could that be locking everything up? Suggestion to place console.log() statements to see if execution progresses passed L21. Comment out L22 and L24 and replace with console.log()
Is var wifi equal to anything, or is it null/undefined after L14
L4 are D0 and D1 defined somewhere else and pointing to correctly wired pins? What is the result of pinMode()?
and, no init() function should save() be used.
'save()' is not affecting anything. Sorry I mentioned it. you can ignore it. I was simply trying to share that it seemed to work for a second or two.
day 1 - working flawlessly for hours. Went to sleep happy.
day 2 - not working all day (no changes. getting error: "No 'ready' after AT+RST")
day 3 - still not working all day. I try different things. No go. try one silly thing. It worked. Did a "Save()" then power cycled it (turned it off then on again) it no longer works. Try a bunch of things and cannot get it to connect to ANY network any time any where.
Here's the code: