ESP32-Problem uploading (dht22&ESP32int.sensors) data to the platform

Post Reply
victor6303
Noob
Posts: 2
Joined: Sun Feb 03, 2019 10:02 pm

ESP32-Problem uploading (dht22&ESP32int.sensors) data to the platform

Post by victor6303 » Sun Feb 03, 2019 10:33 pm

Hello from Spain,

Trying to upload some data from an ESP32 (sensors: dht22 only for temperature&humidity).

Uploading the original example (plus adding dht22 data), I got this

********** requesting URL: https://asksensors.com/api.asksensors/w ... alue232.60
[V][HTTPClient.cpp:140] beginInternal(): url: https://asksensors.com/api.asksensors/w ... odule1=100
[W][HTTPClient.cpp:152] beginInternal(): unexpected protocol: https, expected http
[V][HTTPClient.cpp:140] beginInternal(): url: https://asksensors.com/api.asksensors/w ... odule1=100
[D][HTTPClient.cpp:181] beginInternal(): host: asksensors.com port: 443 url: /api.asksensors/write/vfIcyRAlOmlQfDk5AB06InVhJSvM43EZ?module1=100
[V][ssl_client.cpp:211] stop_ssl_socket(): Cleaning SSL connection.
[V][ssl_client.cpp:53] start_ssl_client(): Free heap before TLS 226740
[V][ssl_client.cpp:55] start_ssl_client(): Starting socket
[V][ssl_client.cpp:88] start_ssl_client(): Seeding the random number generator
[V][ssl_client.cpp:97] start_ssl_client(): Setting up the SSL/TLS structure...
[ssl_client.cpp:121] start_ssl_client(): WARNING: Use certificates for a more secure communication!
[V][ssl_client.cpp:145] start_ssl_client(): Setting hostname for TLS session...
[V][ssl_client.cpp:160] start_ssl_client(): Performing the SSL/TLS handshake...
[V][ssl_client.cpp:179] start_ssl_client(): Verifying peer X.509 certificate...
[V][ssl_client.cpp:188] start_ssl_client(): Certificate verified.
[V][ssl_client.cpp:203] start_ssl_client(): Free heap after TLS 186152
[D][HTTPClient.cpp:850] connect(): connected to asksensors.com:443
[V][ssl_client.cpp:242] send_ssl_data(): Writing HTTP request...
[V][HTTPClient.cpp:938] handleHeaderResponse(): RX: 'HTTP/1.1 200 200'
[V][HTTPClient.cpp:938] handleHeaderResponse(): RX: 'Date: Sun, 03 Feb 2019 22:29:26 GMT'
[V][HTTPClient.cpp:938] handleHeaderResponse(): RX: 'Server: Apache/2.4.35 (codeit) OpenSSL/1.1.1'
[V][HTTPClient.cpp:938] handleHeaderResponse(): RX: 'Content-Type: text/plain; charset=UTF-8'
[V][HTTPClient.cpp:938] handleHeaderResponse(): RX: 'Content-Length: 1'
[V][HTTPClient.cpp:938] handleHeaderResponse(): RX: 'Connection: close'
[V][HTTPClient.cpp:938] handleHeaderResponse(): RX: ''
[D][HTTPClient.cpp:968] handleHeaderResponse(): code: 200
[D][HTTPClient.cpp:971] handleHeaderResponse(): size: 1
[V][ssl_client.cpp:211] stop_ssl_socket(): Cleaning SSL connection.
[D][HTTPClient.cpp:1101] writeToStreamDataBlock(): connection closed or file end (written: 1).
[V][HTTPClient.cpp:244] end(): tcp is closed
200
1
[V][HTTPClient.cpp:244] end(): tcp is closed
********** End
*****************************************************




On the platform I can see only 100 (continuosly) for Temperature (!) and that's all. No humidity.


Any idea about what can be wrong?
Thank you in advance!


Jorge

Guru
Pro
Posts: 33
Joined: Tue Dec 18, 2018 11:36 pm
Contact:

Re: ESP32-Problem uploading (dht22&ESP32int.sensors) data to the platform

Post by Guru » Mon Feb 04, 2019 9:36 am

Hello and welcome :-)
Your url is wrong:
https://asksensors.com/api.asksensors/w ... alue232.60
Here is the right format:
https://asksensors.com/api.asksensors/w ... ule2=32.60
I have just done a test using my browser. It works fine and you should receive data. See the enclosed image.

Please refer to this guide for a detailed description of the AskSensors API format. https://asksensors.com/gettingstarted.html.
You may notice that we recommend to use https://api.asksensors.com/write/.... Instead of https://asksensors.com/api.asksensors/write/....
AskSensors now works with both ;-)

Feel free to ask.
Regards.
Attachments
Ima.PNG
Ima.PNG (7.43 KiB) Viewed 22668 times

victor6303
Noob
Posts: 2
Joined: Sun Feb 03, 2019 10:02 pm

Re: ESP32-Problem uploading (dht22&ESP32int.sensors) data to the platform

Post by victor6303 » Mon Feb 04, 2019 12:52 pm

Nope, it doesn't show any data (or at least, I can't see it), but thanks for your help!

The code I used was quite similar to the ESP32+DHT11/22 example indicated here: https://asksensors.com/doc/WeatherStations.html#ref2 which shows some differences itself...
Source Code :
// Create a URL for the request
String url = "https://asksensors.com/api.asksensors/write/";
url += apiKeyIn;
url += "?module1=";
url += myTemperature;
url += "&module2=";
url += myHumidity;

Besides, when I compare it to the one published on "Instructables", looks like the URL (to be specified) is not even necessary in their code (?!)
Image


Anyway, I'll try it later and see if I can get those values can be seen on the graphic modules, finally. So, I'll be back! :-)
Regards!


Jorge

Guru
Pro
Posts: 33
Joined: Tue Dec 18, 2018 11:36 pm
Contact:

Re: ESP32-Problem uploading (dht22&ESP32int.sensors) data to the platform

Post by Guru » Mon Feb 04, 2019 9:45 pm

Victor,
You should receive data on Module 1 and Module 2 of the Sensor with the API Key you provided. please double check.
The URL is always necessary.

Post Reply