can the "generic http" controller to do what this cURL does?

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
datenheim
Normal user
Posts: 2
Joined: 17 Oct 2019, 08:31

can the "generic http" controller to do what this cURL does?

#1 Post by datenheim » 17 Oct 2019, 18:58

Hi all,

being quite new to ESPeasy world I wonder if/how the generic http controller could do what below mentioned cURL does.

I am using ESP_Easy_mega-20191003_normal_ESP8266_4M1M.bin on Wemos D1 mini and have a pulse counter device running on D7.
This all works as expected and the counter gives a Count/Total/Time values in the device screen.

Executing this cURL would push the data very easily to Thingsboard:

Code: Select all

curl -v -d "{"count":X,"total":Y,"time":Z}" http://10.44.44.230:9090/api/v1/gJIauK8RdikKVHwNTfnK/telemetry --header "Content-Type:application/json"
and produces this output:

Code: Select all

*   Trying 10.44.44.230...
* TCP_NODELAY set
* Connected to 10.44.44.230 (10.44.44.230) port 9090 (#0)
> POST /api/v1/gJIauK8RdikKVHwNTfnK/telemetry HTTP/1.1
> Host: 10.44.44.230:9090
> User-Agent: curl/7.58.0
> Accept: */*
> Content-Type:application/json
> Content-Length: 27
> 
* upload completely sent off: 27 out of 27 bytes
< HTTP/1.1 200 
< X-Content-Type-Options: nosniff
< X-XSS-Protection: 1; mode=block
< Cache-Control: no-cache, no-store, max-age=0, must-revalidate
< Pragma: no-cache
< Expires: 0
< Content-Length: 0
< Date: Thu, 17 Oct 2019 16:54:11 GMT
< 
* Connection #0 to host 10.44.44.230 left intact
where X, Y, Z should get the actual values of the counter and so on.
The name of the keys (count, total, time) could be hard coded or have whatever name was given in the counter device.

Could the general http controller be used for that (or any other controller which is available out of the box) :?:

Post Reply

Who is online

Users browsing this forum: Google [Bot] and 20 guests