Page 1 of 1

ESP8266 on nodeCMU, authorization problem

Posted: Tuesday 02 February 2016 9:03
by cobrp
I am trying to build a temperature monitoring device with a nodeCMU communicating with Domoticz. For details, see https://www.domoticz.com/wiki/ESP8266_WiFi_module.

Programming of the nodeCMU is done with Esplorer.

Everything is going well, but the temperature values are not accepted by Domoticz. At first I got the 401 message. My Domoticz implementation wants uid/pwd.
When I isolate the json-call and use it in a browser, the value is accepted and shown in Domoticz. My browser was logged in on Domoticz.
My problem is the way to include Authorization. I tried:

Code: Select all

conn:send("GET /json.htm?type=command&param=udevice&idx=59&nvalue=0&svalue=" .. t ..  "HTTP/1.1\r\nHost: 192.168.nnn.nnn\r\n"
 .."Authorization: Basic xxxxxxxxxxxxxxxxxx\r\nConnection: keep-alive\r\nAccept: */*\r\n\r\n") 


(the x's is my base64 coded uid/pwd)

The result is: nil and no accepted value in Domoticz.
Anyone with a better idea? (The syntax of the Lua implementation on the nodeCMU is NOT very well documented!)

Re: ESP8266 on nodeCMU, authorization problem

Posted: Tuesday 02 February 2016 9:07
by gizmocuz
Does your ESP runs in your private network, or can get a fixed IP address ?
If yes, you can add this in the Local Network settings of domoticz so it does not need a username/password

Re: ESP8266 on nodeCMU, authorization problem

Posted: Tuesday 02 February 2016 9:32
by cobrp
:D Thank you, that did it!

Re: ESP8266 on nodeCMU, authorization problem

Posted: Saturday 08 April 2017 21:46
by tazitiz
I have a nodemcu that i want to keep dhcp-ing and therefore wanted the authentication going. Now i got it to work, your addition to the header was allmost complete. this is what i got working:

conn:send("GET /json.htm?type=command&param=udevice&idx=501&nvalue=0&svalue=".. t .." HTTP/1.1\r\nHost: www.local.lan\r\n"
.."Authorization: Basic, value: nnnnnnnnnnnnnnnnnnnnnnnnn\r\nConnection: keep-alive\r\nAccept: */*\r\n\r\n")

thanks for your steps - i wouldn't get it to work on my end if you didn't post your question!