JanGoe / esp8266-wifi-relay

ESP8266-ESP12e Wifi Doppel Relay IOT Unterputz Montage möglich / Schaltaktor
142 stars 37 forks source link

please add timer to Wifi hotspot #56

Open tkoeberl opened 7 years ago

tkoeberl commented 7 years ago

Hi, after a power failure the access point is slower than the ESP's. The ESP's power up in hotspot mode. Can you please add the functionality to reset the ESP after X minutes if it is in hotspot mode?

thanks, -thomas

prikril commented 7 years ago

Here is a quick and dirty hack (UNTESTED) for you, restarting the ESP after 5 minutes. Add these lines at the end of "servernode.lua":

TMR_AUTORESTART_ID = 1
AUTORESTART_IN_MINUTES = 5
AUTORESTART_TIMER_ENABLED = true
tmr.alarm(TMR_AUTORESTART_ID, AUTORESTART_IN_MINUTES*60*1000, tmr.ALARM_SINGLE, function()
  if(AUTORESTART_TIMER_ENABLED == true) then
    node.restart()
  end
end)

Please test it only on one ESP first.

tkoeberl commented 7 years ago

cool, this should go into the sources.

prikril commented 7 years ago

So it worked?

tkoeberl commented 7 years ago

Sorry, dont have time to test it. end of year in IT business.

prikril commented 7 years ago

ok, no problem.

tkoeberl commented 7 years ago

Hi, its working, thanks.