title: lua: init.lua:15: attempt to call method 'alarm' (a nil value)
body: <p>i am trying to fix a piece of code i did find online. (yeah i know....)
  But in case you guys can help me out wihth this error it would be just amazing:</p>
  
  <p>Error: lua: init.lua:15: attempt to call method 'alarm' (a nil value)</p>
  
  <p>Code (from here: <a href="https://github.com/Christoph-D/esp8266-wakelight" rel="nofollow noreferrer">https://github.com/Christoph-D/esp8266-wakelight</a>)</p>
  
  <pre><code>dofile("globals.lc")
  
  wifi.setmode(wifi.STATION)
  wifi.sta.config(WIFI_SSID, WIFI_PASSWORD)
  wifi.sta.sethostname(MY_HOSTNAME)
  if WIFI_STATIC_IP then
    wifi.sta.setip({ip = WIFI_STATIC_IP, netmask = WIFI_NETMASK, gateway = WIFI_GATEWAY})
  end
  wifi.sta.connect()
  
  -- Initialize the LED_PIN to the reset state.
  gpio.mode(LED_PIN, gpio.OUTPUT)
  gpio.write(LED_PIN, gpio.LOW)
  
  tmr.alarm(
    MAIN_TIMER_ID, 2000, tmr.ALARM_AUTO, function ()
      if wifi.sta.getip() then
        tmr.unregister(MAIN_TIMER_ID)
        print("Config done, IP is " .. wifi.sta.getip())
        dofile("ledserver.lc")
      end
    end)
  </code></pre>
  
  <p>What can i do there? Whats wrong?</p>
  
  <p>Cheers and thank you!!!</p>