Chat freely about anything...

User avatar
By Ranemyr
#27426 Hi

I am struggling and on the breach to surrender, but before i will give the forum a go and see if someone can give me some guidance to success. :-)

I am about to send a bool variable to my SwitchKing REST server.
When i use my webbrowser it works 100% and also when i use Tasker it work flawless.
But i am not able to get ESP8266 to do as i like.
Working with ESP8266 on Serial to RealTerm 9600/8N1
When i am sending the command over the Webbrowser or Tasker the command is
192.168.0.230:9876/datasources/20/addvalue?value=0


(I use HW reset on ESP8266)

AT+GMR // Get FW version
00200.9.5(b1)

AT+CWMODE=1 // End station only
OK

AT+CIPMUX=0 // Single connection
OK

AT+CWJAP="MYSSID";"MYPASSCODE" // Join Wifinetwork and get IP/no from DHCP server
OK

AT+CIPSTART"TCP,"192.168.0.230",9876 //Local IP and Port to my Rest SK Server
CONNECT
OK

AT+CIPSEND=(no of chars to send)
>

Until this point it behaves as predicted
But i do think i get the string wrong when i try to enter in best cases i get respons "OK" but nothing happens, most of time i get +IPD,490:HTTP/1.1 400 Bad Request

I think (wrongly of course since it´s not working) that this string would be correct
AT+CIPSEND=79
>GET /datasources/20/addvalue?value=1 HTTP/1.0\r\nHost: 192.168.0.230\n\r\n\r\n\r

Can anyone pls help me out of my misery.
User avatar
By Barnabybear
#27447 Hi, try:
AT+CIPSEND=77 or AT+CIPSEND=75
Don't ask me why but I have to define the string length as 2 or 4 less than the expected value. Don't understand but it works for me.
User avatar
By Ranemyr
#27474 Hi, I have tried with different values on AT+CIPSEND=xx if i have to low value it does not send the whole string, if i have to high number it waits for more char´s to send and i need to terminate the command with AT+CIPCLOSE.
User avatar
By martinayotte
#27498 In your URL request, we see "Host: 192.168.0.230\n\r\n\r\n\r", it should be "Host: 192.168.0.230\r\n\r\n"
Also, about length, "\r\n" is count as 2 characters, and it can't be transmitted as is thru a serial monitor such putty, except if transmitted as Ctrl-M/Ctrl-J, otherwise it need to be sent from the arduino sketches, of python scripts.