New LUA firmware and old codes do not match
Posted: Mon Mar 29, 2021 11:03 am
Hello forum,
I am a LUA newbie (to put it nicely ... and I don't really want to become a specialist)) and would like to work through these instructions:
https://www.instructables.com/Motorized-WiFi-IKEA-Roller-Blind/
I flashed firmware from January 2021 on the ESP-32 and it somehow no longer fits with the instructions or the new LUA commands / old firmware ...
NodeMCU 3.0.0.0 built on nodemcu-build.com provided by frightanic.com
branch: release
commit: 136e09739b835d6dcdf04034141d70ab755468c6
release: 3.0.0-release_20210201
release DTS: 202102010145
SSL: true
build type: float
LFS: 0x0 bytes total capacity
modules: file,gpio,mqtt,net,node,pwm,tmr,uart,wifi,tls
build 2021-03-02 20:04 powered by Lua 5.1.4 on SDK 3.0.1-dev(fce080e)
The wifi_setup.lua of the instructions says:
I successfully googled that the command "wifi.sta.config (key, config.SSID [key])" has to be replaced by "wifi.sta.config {ssid = key, pwd = config.SSID [key]}".
Now comes the next error message
"wifi_setup.lua: 29: attempt to call field 'alarm' (a nil value)"
That has something to do with the "old" command "tmr.alarm".
The solution would be to find / use a firmware from 2017 or to replace the "tmr.alarm" command ...
I hope for help from you ... (and I can't reach the author / won't get in touch).
Greetings
I am a LUA newbie (to put it nicely ... and I don't really want to become a specialist)) and would like to work through these instructions:
https://www.instructables.com/Motorized-WiFi-IKEA-Roller-Blind/
I flashed firmware from January 2021 on the ESP-32 and it somehow no longer fits with the instructions or the new LUA commands / old firmware ...
NodeMCU 3.0.0.0 built on nodemcu-build.com provided by frightanic.com
branch: release
commit: 136e09739b835d6dcdf04034141d70ab755468c6
release: 3.0.0-release_20210201
release DTS: 202102010145
SSL: true
build type: float
LFS: 0x0 bytes total capacity
modules: file,gpio,mqtt,net,node,pwm,tmr,uart,wifi,tls
build 2021-03-02 20:04 powered by Lua 5.1.4 on SDK 3.0.1-dev(fce080e)
The wifi_setup.lua of the instructions says:
Code: Select all
-- file: setup.lua
local module = {}
local function wifi_wait_ip()
if wifi.sta.getip() == nil then
print("IP unavailable, Waiting...")
else
tmr.stop(1)
gpio.write(pin_led,1) --off
print("\n====================================")
print("ESP8266 mode is: " .. wifi.getmode())
print("MAC address is: " .. wifi.ap.getmac())
print("IP is "..wifi.sta.getip())
print("====================================")
mq.start()
end
end
local function wifi_start(list_aps)
if list_aps then
gpio.write(pin_led,0) --on
for key,value in pairs(list_aps) do
if config.SSID and config.SSID[key] then
wifi.setmode(wifi.STATION);
wifi.sta.config{ssid=key,pwd=config.SSID[key]}
wifi.sta.connect()
print("Connecting to " .. key .. " ...")
-- config.SSID = nil -- can save memory
tmr.alarm(1, 2500, 1, wifi_wait_ip)
end
end
else
print("Error getting AP list")
end
end
function module.start()
print("Configuring Wifi ...")
wifi.setmode(wifi.STATION);
wifi.sta.getap(wifi_start)
end
return module
I successfully googled that the command "wifi.sta.config (key, config.SSID [key])" has to be replaced by "wifi.sta.config {ssid = key, pwd = config.SSID [key]}".
Now comes the next error message
"wifi_setup.lua: 29: attempt to call field 'alarm' (a nil value)"
That has something to do with the "old" command "tmr.alarm".
The solution would be to find / use a firmware from 2017 or to replace the "tmr.alarm" command ...
I hope for help from you ... (and I can't reach the author / won't get in touch).
Greetings