UbidotsESP8266.h, get value bad request


#21

Sorry @Metavix, Which web?
I put 10Kohm resistor for the pulldown but it still the same. and i’m still using old firmware of ESP8266.
Can I see what the web got from my arduino? i mean somthing like debug my dashboard?
Or do you have another library for ESP as module but using MQTT?

Best Regards,
Kutarte


#22

@kutarte we have another lib with MQTT but that lib is to use an ESP as Stand alone mode and you are using it as bridge, my suggestion to do that is use a borad with 2 Serial port, a MEGA for example.

Best regards,
Metavix


#23

@metavix,
I just sniffing communication between arduino and esp8266. After the first time get a response from cipsend, the next AT Command will reply with a bad request , error 400, although only send AT, AT + GMR, AT+CIPCLOSE, or the others AT Command , my esp8266 will always reply this:

HTTP/1.1 400 Bad Request
Server: nginx
Date: Wed, 12 Oct 2016 10:13:22 GMT
Content-Type: text/html
Content-Length: 166
Connection: close

<html>
<head><title>400 Bad Request</title></head>
<body bgcolor="white">
<center><h1>400 Bad Request</h1></center>
<hr><center>nginx</center>
</body>
</html>

This is the log:

AT+CIPSEND

AT+CIPSEND

OK

>

GET /api/v1.6/variables/57e8de5b76254216a82a995e/values?page_size=1 HTTP/1.1
Host: things.ubidots.com
User-Agent: Arduino-ESP8266/1.0
X-Auth-Token: B80RLEzYYE8jzRpECKjqTf9lV88XCC
Connection: close

+++

HTTP/1.1 200 OK
Server: nginx
Date: Wed, 12 Oct 2016 10:00:09 GMT
Content-Type: application/json
Transfer-Encoding: chunked
Connection: close
Vary: Accept-Encoding
Vary: Accept
Allow: GET, POST, HEAD, OPTIONS

148
{"count": 49, "next": "http://things.ubidots.com/api/v1.6/variables/57e8de5b76254216a82a995e/values?page=2&page_size=1", "previous": null, "results": [{"url": "http://things.ubidots.com/api/v1.6/values/57fceb247625423a8e2b74b6", "value": 1.0, "timestamp": 1476193060148, "context": {}, "created_at": "2016-10-11T13:37:40.148"}]}
0

AT

HTTP/1.1 400 Bad Request
Server: nginx
Date: Wed, 12 Oct 2016 10:00:20 GMT
Content-Type: text/html
Content-Length: 166
Connection: close

<html>
<head><title>400 Bad Request</title></head>
<body bgcolor="white">
<center><h1>400 Bad Request</h1></center>
<hr><center>nginx</center>
</body>
</html>

AT+CIPMUX=0

HTTP/1.1 400 Bad Request
Server: nginx
Date: Wed, 12 Oct 2016 10:00:22 GMT
Content-Type: text/html
Content-Length: 166
Connection: close
<html>
<head><title>400 Bad Request</title></head>
<body bgcolor="white">
<center><h1>400 Bad Request</h1></center>
<hr><center>nginx</center>
</body>
</html>

AT+CIPSTART=“TCP”,“things.ubidots.com”,80

HTTP/1.1 400 Bad Request
Server: nginx
Date: Wed, 12 Oct 2016 10:00:26 GMT
Content-Type: text/html
Content-Length: 166
Connection: close

<html>
<head><title>400 Bad Request</title></head>
<body bgcolor="white">
<center><h1>400 Bad Request</h1></center>
<hr><center>nginx</center>
</body>
</html>

AT+CIPMODE=1

HTTP/1.1 400 Bad Request
Server: nginx
Date: Wed, 12 Oct 2016 10:00:36 GMT
Content-Type: text/html
Content-Length: 166
Connection: close

<html>
<head><title>400 Bad Request</title></head>
<body bgcolor="white">
<center><h1>400 Bad Request</h1></center>
<hr><center>nginx</center>
</body>
</html>

AT

HTTP/1.1 400 Bad Request
Server: nginx
Date: Wed, 12 Oct 2016 10:00:39 GMT
Content-Type: text/html
Content-Length: 166
Connection: close

<html>
<head><title>400 Bad Request</title></head>
<body bgcolor="white">
<center><h1>400 Bad Request</h1></center>
<hr><center>nginx</center>
</body>
</html>

Best Regards,
Kutarte


#24

Nice! @kutarte well i think what is the problem, it is not closing the TCP socket you are using the lib or you are puting all commands manually?

There are two methods to close that connection:

  1. Send a command to close it.
  2. Send at CIPSEND command the lenght of the message.

Answer me to do a correction in the lib, or send you the respective solution of that.

Best regards,
Metavix


#25

@Metavix, I’m using the lib
I send AT+CIPCLOSE but it’s just response the same thing.

Please do the correction in the lib, Thank you.

Best Regards,
Kutarte