Left here for archival purposes.

User avatar
By Calin
#46061 I try to give a name to each device on the network to which I am connected

wifi.setmode(wifi.STATION)
wifi.sta.config("........","..........")

if (wifi.sta.sethostname("NodeMCU") == true) then
print("hostname was successfully changed")
else
print("hostname was not changed")
end
And I receive:
> dofile("pwm_analog_on_off_1.lua");
pwm_analog_on_off_1.lua:1: attempt to call field 'sethostname' (a nil value)

So what 's wrong ?
Thank you
Calin
User avatar
By TerryE
#46396 Sounds like you are using a current dev build. This API function was only added recently