There are several plugins here showing how to work with HTTP Lua module on Ezlo Plus and Ezlo Secure hubs.
All sources of the plugins have comments in the code.
In the first example, calling the script http_test/scripts/http_request results in the generation of a GET HTTP request with parameters to the postman-echo.com HTTP echo service, which generates a response with the same HTTP headers and parameters as the GET HTTP request. The plugin accepts this response and prints it to the console.
The second example is an advanced version of the first plugin and allows you to make a request to yahoo finance portal and get information about favorite stocks.
To run it on your Ezlo Plus or Ezlo Secure you need:
- unzip and copy the content of the archive into a
/opt/firmware/bin/ha-infocmd hub.extensions.custom_plugin.register http_testto register the plugin
- execute a
hub.extensions.plugin.runrequest with a
scriptparameter set to a
- to see plugin results you may look at logs