Generic HTTP more values [SOLVED]

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
mikrom
Normal user
Posts: 13
Joined: 19 Apr 2017, 19:19

Generic HTTP more values [SOLVED]

#1 Post by mikrom » 19 Apr 2017, 19:36

Hi all,

I am playing with it, now I am on latest ESPEasy2 and because of "almost no documentation" I am not able to find how and which variable I can use.

there is a GREAT website for logging temperature and humidity: tmep.cz (also available in many languages)
for sending values you can only HTTP GET http://ahoj.tmep.cz/?mojemereni=25.6&humV=60 (where "ahoj" is your subdomain and "mojemereni" is temperature and can be set to some really unique). It is also available on github and you can use it on your own domain.

My working setup is:
Protocol: Generic HTTP
Locate controller: Use hostname
Controller hostname: mikrom-test.tmep.cz
Controller port: 80
Controller publish: ?mojemereni=%value%

BUT
If I want to send also humidity, and change Controller publish to: ?mojemereni=%value%&humV=%value% I don't know what use as value2 for humidity.

by trial-error I found only %valname%, %value%, %sysname%, %id% are translated (to something, not send as raw "%variable%"), rest variables are not :(
%val1%, %value2%.. not working

Sensor is DHT11, and settings page shows correctly two rows with values (for Value name 1 and Value name 2, formulas, decimal points etc)

I really looked for hard, but found nothing, any ideas?
Last edited by mikrom on 29 Apr 2017, 18:31, edited 1 time in total.

krikk
Normal user
Posts: 118
Joined: 28 Feb 2017, 07:57
Location: Austria
Contact:

Re: Generic HTTP more values

#2 Post by krikk » 19 Apr 2017, 21:50

use the Generic HTTP Advanced Controller...

Doku: https://www.letscontrolit.com/wiki/inde ... P_Advanced

...but this is only available in latest 2.0.0 release... (even better would it be if you compile the latest git version, because the last release does not have the latest fixes...)

...if you can not solve you task with this controller, post it here...

mikrom
Normal user
Posts: 13
Joined: 19 Apr 2017, 19:19

Re: Generic HTTP more values

#3 Post by mikrom » 19 Apr 2017, 22:44

I have v2.0.0-dev7 and there is no Advanced option, I will try latest GIT and let know

EDIT: I see. It is not available in normal version! it's only in test and dev version. I have some troubles with setting it up, I am falling in bootloop with tons of weird hex characters in terminal, but I am not giving up yet.

mikrom
Normal user
Posts: 13
Joined: 19 Apr 2017, 19:19

Re: Generic HTTP more values

#4 Post by mikrom » 25 Apr 2017, 12:01

okay so here is my latest results:

Generic HTTP
Hostname: mikrom-test.tmep.cz
Port: 80
Controller publish: ?mojemereni=%value%

works as expected, almost. Only small bug is (if I have DHT11 connected) that in %value% is temperature, in next GET it is humidity, in next temperature again, then humidity etc.. but I suppose if I use D18B20 for ex. it will be okay.

At tmep website is debugging option which shows all HTTP requests to the page, so I can see that mikrom-test.tmep.cz/?mojemereni=25.0 is correct

Generic HTTP Advanced [TESTING]
Hostname: mikrom-test.tmep.cz
Port: 80
Controller publish: ?%vname1%=%val1%&%vname2%=%val2%

and every possible option, even namually written "?mojemereni=25.0" did not send anything to tmep (nothing in tmep's degug page)

Tried yesterday with latest ESPEasy_v2.0.0-dev8 (github version last week with same results)

So, I overlook something significant or it is not working :)

mikrom
Normal user
Posts: 13
Joined: 19 Apr 2017, 19:19

Re: Generic HTTP more values

#5 Post by mikrom » 25 Apr 2017, 22:16

I found Log Level in Advanced Tools, with loglevel 4 for serial port I can see

Generic HTTP

Code: Select all

HTTP : connecting to 89.221.208.65:80
/?mojemereni=26.0
HTTP/1.1 200 OK

HTTP : Success!
Date: Tue, 25 Apr 2017 19:55:05 GMT

Server: Apache/2.4.18 (Ubuntu)

Vary: Accept-Encoding

Connection: close
Generic HTTP Advanced

Code: Select all

HTTP : connecting to 89.221.208.65:80
HTTP before parsing: 
GET /?%vname1%=%val1% HTTP/1.1
Host: t:80
Connection: close

HTTP after parsing: 
GET /?%vname1%=%val1% HTTP/1.1
Host: t:80
Connection: close

HTTP after replacements: 
GET /?mojemereni=27.0 HTTP/1.1
Host: t:80
Connection: close

GET /?mojemereni=27.0 HTTP/1.1
Host: t:80
Connection: close

HTTP : closing connection
just tried with git version, all same.. so I'll come later and hope :)

EDIT: definitelly something rotten in _C011.ino (Generic HTTP Advanced [TESTING]). _C008.ino (Generic HTTP) has different, working, making HTTP request.

krikk
Normal user
Posts: 118
Joined: 28 Feb 2017, 07:57
Location: Austria
Contact:

Re: Generic HTTP more values

#6 Post by krikk » 28 Apr 2017, 17:32

if you post you controller settings, we would have a chance to help you... example how the resulting url should look like would also help...

mikrom
Normal user
Posts: 13
Joined: 19 Apr 2017, 19:19

Re: Generic HTTP more values

#7 Post by mikrom » 28 Apr 2017, 19:45

thanks kirk, but all was written.. so I attach some pictures :)

1. if you put in the browser this url: http://mikrom-test.tmep.cz/?mojemereni=22&humV=55
2. it pass, and 22 is written as temperature and 55 as humidity
3. you can check it in this JSON export from last received data: https://tmep.cz/vystup-json.php?id=194& ... htxuqromp0 (don't worry it is only for testing, so feel free to try)

After log in I can debug received data like this (it shows everything what came in)
Image

If I use Generic HTTP like this
Image

It works, only think is once I get Temperature as %value% and than Humidity is in %value% and so on. You can see it in debug page
Image

But if I use Generic HTTP Advanced
Image

I get nothing in debug page. Absolutely nothing, no wrong data, just nothing. Problem is in GET request, I think that "t" is wrong there

Code: Select all

GET /?mojemereni=25.00&humV=18.00 HTTP/1.1
Host: t:80
Connection: close
(this is from serial console If I change debug level fron 2 to 4.

krikk
Normal user
Posts: 118
Joined: 28 Feb 2017, 07:57
Location: Austria
Contact:

Re: Generic HTTP more values

#8 Post by krikk » 28 Apr 2017, 22:34

you where correct, the hostname was not passed correctly, fixed it...

https://github.com/letscontrolit/ESPEasy/pull/250 <-- little fix :)

mikrom
Normal user
Posts: 13
Joined: 19 Apr 2017, 19:19

Re: Generic HTTP more values

#9 Post by mikrom » 28 Apr 2017, 23:48

great! but it is not enough

after I add second \r\n at the end of request it seems to start to work!

row 177: - payload += F("Connection: close\r\n");
row 177: + payload += F("Connection: close\r\n\r\n");

can you please make a commit on github, I am not familiar with it :)

krikk
Normal user
Posts: 118
Joined: 28 Feb 2017, 07:57
Location: Austria
Contact:

Re: Generic HTTP more values

#10 Post by krikk » 29 Apr 2017, 16:11

right again, updated the pull request...

mikrom
Normal user
Posts: 13
Joined: 19 Apr 2017, 19:19

Re: Generic HTTP more values [SOLVED]

#11 Post by mikrom » 29 Apr 2017, 18:30

awesome! we can mark this as solved now.

Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 4 guests