Feature request: hardware.enable/disablewifi

There are situations when the IMP should work when Cloud connection was lost.
Example: valve/relay control (in a pool, in a garden, anywhere else)

  • power goes down/wifi goes down
  • backup power available from a CR2032 (this will keep IMP alive only to keep his RTC on, WIFI search would eat the battery soon)
  • at this step wifi should be disabled and keep the IMP in a sleep mode only with RTC working and doing nothing (can this be achieved with one of the deep sleep modes?)
  • when power gets back enable wifi module back (high chance to not get back the internet connection or get it back later)
  • till there is no valid wifi connection perform emergency code (let the relay to be controlled manually for example)

Is this possible using a deep sleep mode? (if any of them is disabling wifi communication but keeping RTC I have what I need).
If not possible with deep sleep is it possible to have such a thing in the future? I know You want most of the functionality in the cloud but You have to understand that there are cases when the IMP has to do something exactly because there is no WiFi.

Deep sleep disables wifi but keeps the RTC running.

However, at wake it currently tries to connect to the server, and won’t run code until it manages this. We’re working through the tasks necessary to allow “shallow” wakes, where we wake and run code without turning on wifi - this is needed to reduce power for batched data collection nodes, for example - but they’re not all implemented yet.

Release-5 had one of the major requirements for this implemented, which was the squirrel code being cached in flash on the imp, but there are others to come.

Short answer: you can’t do this now, but should be able to by the end of the year.

Just checked server.sleepfor and might be halfway for what I need:

  • does server.sleepfor keep the RTC running during sleep?
  • does the IMP restart the last code after returning (even if there is no wifi)? I remember this was discussed a time ago on the forum and Hugo told something about a possible future development - will this feature work and if it does when it is planned?
  • is it a possibility in the squirrel to know the wifi status (connected/not connected)?

Ow - just wrote in the same time with You - got it, ty.

Hello all,

Can anyone tell me how to get the Imp to restart the WI-FI connection i.e. if the wifi gos I need to restart my imp as it appears not to reconnect on the wifi coming back . Please advise …

Thanks in advance

Cheers Rob C:)

It should reconnect eventually as long as you’re trying to send something from the imp end (otherwise, it doesn’t actually notice the connection has gone away); the next release has more robust behavior than this in terms of noticing wifi link has gone and forcing a reconnect attempt.