EPS8266 sleep when not connected / WiFi n/a

Yes i know - it was just an example.

what happens on the spot, plays no role in my problem.
The point is that the meter does not count correctly, but directly triggers the if function, even if ‘noConnect = 5’ has not yet been reached.