How to work with HTTP LUA module on Ezlo Plus and Ezlo Secure

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 /home/data/custom_plugins/ directory
  • run /opt/firmware/bin/ha-infocmd hub.extensions.custom_plugin.register http_test to register the plugin
  • execute a hub.extensions.plugin.run request with a script parameter set to a HUB:http_test/scripts/http_request
  • to see plugin results you may look at logs /var/log/firmware/ha-luad.log

Sources of the plugins with comments in the code:
http_example_postman.zip (1.7 KB)
http_example_finance.zip (1.9 KB)

2 Likes

Hi @Oleh
thank you for these examples, but for me it’s not meaningful because you have to explore the EzloPlus …
I need to write a script to, for example, check the status of the batteries of my detectors and send me an SMS telling me which one has a problem, or for example to check the temperatures and humidity of certain outdoor areas to water the plants in relation to the weather.
Or, to be able to create a virtual On / Off or a slider or even a virtual container which would allow you to see a result written on it; because for the moment I do not see a store to add plugins like on Vera. Sorry but these are the ones I’m used to with the system. I would add that it is very difficult to code with a smartphone or tablet, sorry to insist on web access. I know the hardest part is keeping it simple for us end users but when can we soon be able to play easily and simply with these tools and how can we use the API locally please?

EDIT
sorry for the writing i use google translation