I get a message:
ua: init.lua:14: pwd:0,8~64
and the script stops.
Is there a way of handling an invalid password?
(I'm a complete novice on Lua)
Explore... Chat... Share...
iWifiTries = 0 -- Counter of tries to connect to wifi
iMaxTries = 10 -- Maximum number of tries while waiting for connection
--setup baudrate
--uart.setup(0,115200,8,0,1)
--3s delay before starting with the program, sufficient break execution if needed
--tmr.alarm(0,3000,0,function() dofile("init2.lua") end)
--check for config.lc
if pcall(function ()
dofile("config.lc")
end) then
print("Connecting to SSID("..ssid..")")
wifi.setmode(wifi.STATION)
wifi.sta.config(ssid,password)
wifi.sta.connect()
tmr.alarm(1, 1000, 1, function()
if wifi.sta.getip() == nil then
print("SSID("..ssid..")["..iWifiTries.."]")
iWifiTries = iWifiTries + 1
if ( iWifiTries > iMaxTries ) then
print("Not able to connect to predefined WIFI so deleting config.lc file")
file.remove("config.lc")
node.restart()
end
else
tmr.stop(1)
print("Connected, IP is "..wifi.sta.getip())
dofile("run_program.lc")
end
end)
else
print("Enter configuration mode")
dofile('run_config.lc')
endIt takes about 20-25 seconds for home assistant c[…]
I tried to upgrade tof my sonoff basic R2 with the[…]
a problem Perhaps you want to define "Probl[…]
Rebooting your router will not give you a faster I[…]
There are no other notifications from esptool.py i[…]
Using the Arduino IDE, you'll learn how to set up […]
In this project, you will post to Twitter using an[…]
In this project, we will build a water level contr[…]
I guess I'm late, but I had the same problem and f[…]
Last night I received my first D1 Minis for a lear[…]
Although I am aware that this is an old post, I fe[…]