mirror of
https://github.com/nodemcu/nodemcu-firmware.git
synced 2025-01-30 21:12:55 +08:00
6926c66b16
* Add missing globals from luacheck config * Fix luacheck warnings in all lua files * Re-enable luacheck in Travis * Speed up Travis by using preinstalled LuaRocks * Fix more luacheck warnings in httpserver lua module * Fix DCC module and add appropriate definitions to luacheck config. * Change inline comments from ignoring block to only ignore specific line * Add Luacheck for Windows and enable it for both Windows and Linux * Change luacheck exceptions and fix errors from 1st round of polishing * Add retry and timeout params to wget
26 lines
760 B
Lua
26 lines
760 B
Lua
-- ***************************************************************************
|
|
-- Example for Yeelink Lib
|
|
--
|
|
-- Written by Martin
|
|
--
|
|
--
|
|
-- MIT license, http://opensource.org/licenses/MIT
|
|
-- ***************************************************************************
|
|
|
|
wifi.setmode(wifi.STATION) --Step1: Connect to Wifi
|
|
wifi.sta.config("SSID","Password")
|
|
|
|
local dht = require("dht_lib") --Step2: "Require" the libs
|
|
local yeelink = require("yeelink_lib")
|
|
|
|
yeelink.init(23333,23333,"You api-key",function() --Step3: Register the callback function
|
|
|
|
print("Yeelink Init OK...")
|
|
tmr.create():alarm(60000, tmr.ALARM_AUTO, function() --Step4: Have fun~ (Update your data)
|
|
|
|
dht.read(4)
|
|
yeelink.update(dht.getTemperature())
|
|
|
|
end)
|
|
end)
|