[Pull Request] Generic HTTP fine grained control

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
Olivier
New user
Posts: 6
Joined: 21 Jul 2016, 22:17

[Pull Request] Generic HTTP fine grained control

#1 Post by Olivier » 22 Jul 2016, 23:46

Hi All,

I made some improvement on the Generic HTTP controller => Pull Request #48
You can now select the HTTP method between GET (for compatibility issue), POST & PUT.
You can fully define the URI (instead of relying on the MQTT publish template value).
You can define the HTTP Header as you want and even add some %dynamic% variable that will be replaced by values.
You can define the HTTP Body & use the %dynamic% concept to retreive some values.

The needs was about being able to comply with a JSON REST API, this is now done.

Image

Regards,

Olivier.

lunarok
Normal user
Posts: 34
Joined: 28 Oct 2015, 10:11

Re: [Pull Request] Generic HTTP fine grained control

#2 Post by lunarok » 24 Jul 2016, 03:51

Very Nice. If the pull is accepted, I will look to move jeedom plugin on this format as it's simplier and flexible with the JSON body no need to do extra job for URL too long

Olivier
New user
Posts: 6
Joined: 21 Jul 2016, 22:17

Re: [Pull Request] Generic HTTP fine grained control

#3 Post by Olivier » 24 Jul 2016, 22:02

Obviously you can put whatever data format you want as long as it match the Content-Type header you specify.
This should allow us to connect to every possible http controller, even XML SOAP should work.

FYI ATM I've setup the length limits of URI, Header & Body at 500 char each.
I need to know more about the memory management of the device and Arduino, max size of stack and heap and also the possibility to allocate on demand.

Olivier.

Deennoo
Normal user
Posts: 158
Joined: 07 Sep 2015, 13:03

Re: [Pull Request] Generic HTTP fine grained control

#4 Post by Deennoo » 29 Jul 2016, 16:31

Hoping this will be accepted soon

bertrik
Normal user
Posts: 12
Joined: 27 Jul 2016, 19:11

Re: [Pull Request] Generic HTTP fine grained control

#5 Post by bertrik » 29 Jul 2016, 16:54

I would very much like to have something like this for MQTT too!

For example, being able to specify:
* host name / host ip of the MQTT server
* host port
* topic, possibly with the same kind of macro-expansions using %keyword%
* MQTT user name and password (if applicable)

Perhaps the current MQTT protocols ("Domoticz MQTT", "PiDome MQTT", "OpenHAB MQTT") can be done as specific cases of generic MQTT with certain values pre-filled?

Martinus

Re: [Pull Request] Generic HTTP fine grained control

#6 Post by Martinus » 01 Aug 2016, 12:01

The current pull request is on hold because we need to test and evaluate things before making a final decision. Current proposal has two concerns:

1) Is uses a lot of extra global RAM and this should be avoided where possible.
2) It did not work as a direct replacement for C008 in my testlab. Milage may vary for others, but we would like to avoid any issues. Needs more testing.

So we changed the main ESP Easy files to find a way to solve the RAM issue and adapted the newly proposed plugin for further evaluation. Our current approach:

1) Upgrade to R115 from github
2) Download _C025.ino from the plugin playground and drop it into your ESP Easy project folder
3) Compile and upload
4) Change the controller protocol to "Generic HTTP TEST".
5) Copy and paste the content from tools/advanced/publish template to the HTTP Uri field in the config menu.

I may than work as expected. It's important for us to know upfront that the migration from the existing plugin to the replacement one will be hassle free.

Feedback needed! Thanks in advance for testing...

Olivier
New user
Posts: 6
Joined: 21 Jul 2016, 22:17

Re: [Pull Request] Generic HTTP fine grained control

#7 Post by Olivier » 04 Dec 2016, 09:22

Hi guys

I've deployed the playground but unfortunately it doesn't work as expected.
I don't know exactly why but the Advanced template configuration seems to take precedence over the Generic HTTP one.

Is it possible to work together in order to fix that ?
Also I'm interrested by any feedback on how to debug the ESPEasy firmware once loaded to the board, I got a couple of development in progress and sometimes I lost the UI (I guess due to an overload that makes the webserver to be unable to handle the requests).

Olivier.

Post Reply

Who is online

Users browsing this forum: No registered users and 123 guests