Imp.rssi() reporting zero

This is my first post, so I hope nobody minds if I ask a question.

I’m using imp.rssi() on a temperature sensor that powers up every 5 minutes, but it always returns zero except for the first time after downloading new code. I can’t for the life of me figure out why. Can anyone explain?


imp.rssi() returns zero when WiFi is not currently connected. On a warm boot (i.e., a wakeup from deep sleep), the WiFi will remain off until the first time it’s used (e.g. by a server.log() call).


Thank you Peter! Makes perfect sense. I’ve put a server.log() call at the start of my code and it works fine.