Left here for archival purposes.

User avatar
By rrezaii
#3145 I'm trying to configure esp8266 with wifi credentials using the
Code: Select allwifi.startsmart(6, callback)
function. I have written the following script to do this and I use the TI's iOS app (https://itunes.apple.com/us/app/ti-wifi ... 69322?mt=8) to broadcast the SSID and Key for the wifi that I'd like ESP to be configured with.

Code: Select allfunction callback()
   print("I think I got the wifi credentials!")
   wifi.stopsmart()
   wifi.sta.connect()
   print(wifi.sta.getip())
end

wifi.sta.disconnect()
print(wifi.sta.getip())
wifi.startsmart(6, callback)


Problem: The ESP starts scanning channels but it never gets configured with the credentials.

Code: Select all> dofile("smartWifiConfig.lua")
192.168.1.161
set channel to 6
> switch to channel 1
switch to channel 14
switch to channel 2
switch to channel 3
switch to channel 4
switch to channel 5
switch to channel 7
switch to channel 8
switch to channel 9
switch to channel 10
switch to channel 11
switch to channel 12
switch to channel 13
User avatar
By zeroday
#3177
rrezaii wrote:I'm trying to configure esp8266 with wifi credentials using the
Code: Select allwifi.startsmart(6, callback)
function. I have written the following script to do this and I use the TI's iOS app (https://itunes.apple.com/us/app/ti-wifi ... 69322?mt=8) to broadcast the SSID and Key for the wifi that I'd like ESP to be configured with.

Code: Select allfunction callback()
   print("I think I got the wifi credentials!")
   wifi.stopsmart()
   wifi.sta.connect()
   print(wifi.sta.getip())
end

wifi.sta.disconnect()
print(wifi.sta.getip())
wifi.startsmart(6, callback)


Problem: The ESP starts scanning channels but it never gets configured with the credentials.

Code: Select all> dofile("smartWifiConfig.lua")
192.168.1.161
set channel to 6
> switch to channel 1
switch to channel 14
switch to channel 2
switch to channel 3
switch to channel 4
switch to channel 5
switch to channel 7
switch to channel 8
switch to channel 9
switch to channel 10
switch to channel 11
switch to channel 12
switch to channel 13


It seems that iOS app send different sequences data compare to Android App.
so, iOS app not supported yet. :(
User avatar
By ThomasW
#3179 Hi,

socket:on("connection",..) seems not to be called in server mode, running the example below I get "Received" and "Disconnected" just fine but "Connected" never shows up

Thomas

Code: Select allsrv=net.createServer(net.TCP)
srv:listen(80,function(conn)
   conn:on("connection",function(conn)
      print("Connected")
   end)
   conn:on("receive",function(conn,payload)
      print("Received:" .. payload)
   end)
   conn:on("disconnection",function(conn)
      print("Disconnected")
   end)
end)