Generic HTTP more values [SOLVED]
Moderators: grovkillen, Stuntteam, TD-er
Generic HTTP more values [SOLVED]
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?
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.
Re: Generic HTTP more values
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...
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...
Re: Generic HTTP more values
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.
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.
Re: Generic HTTP more values
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
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
Re: Generic HTTP more values
I found Log Level in Advanced Tools, with loglevel 4 for serial port I can see
Generic HTTP
Generic HTTP Advanced
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.
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
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
EDIT: definitelly something rotten in _C011.ino (Generic HTTP Advanced [TESTING]). _C008.ino (Generic HTTP) has different, working, making HTTP request.
Re: Generic HTTP more values
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...
Re: Generic HTTP more values
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)
If I use Generic HTTP like this
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
But if I use Generic HTTP Advanced
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
(this is from serial console If I change debug level fron 2 to 4.
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)
If I use Generic HTTP like this
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
But if I use Generic HTTP Advanced
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
Re: Generic HTTP more values
you where correct, the hostname was not passed correctly, fixed it...
https://github.com/letscontrolit/ESPEasy/pull/250 <-- little fix
https://github.com/letscontrolit/ESPEasy/pull/250 <-- little fix
Re: Generic HTTP more values
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
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
Re: Generic HTTP more values
right again, updated the pull request...
Re: Generic HTTP more values [SOLVED]
awesome! we can mark this as solved now.
Who is online
Users browsing this forum: Bing [Bot] and 4 guests