Anyone else confirm that “luup.inet.wget” doesn’t work in LUA script in Ezlo scenes?
Just tested trying to send out a simple http command to node red on my LAN and it’s not working, my http command is not carried out when I run the Ezlo scene.
Anyone else confirm that “luup.inet.wget” doesn’t work in LUA script in Ezlo scenes?
Just tested trying to send out a simple http command to node red on my LAN and it’s not working, my http command is not carried out when I run the Ezlo scene.
Hi @cw-kid
I’m checking on this with our level 2 team. Once I get a response I will post an update here.
Thanks.
I can confirm curl commands work in LUA script in Ezlo scenes OK, but not wget
os.execute('curl -X POST http://my-command')
Thank you for the additional feedback.
The issue has been reported to development on Service Desk and hopefully can be addressed soon.
Hi @cw-kid,
On the Ezlo Hubs none of the luup commands exists. Hence you cannot use any of that in scenes. You can look at the new api documentation Lua - Ezlo API Documentation for things you can make to work.
Cheers Rene
Oh yes I forgot they have broken everything.
So we can’t even use our existing lua code
Nope we cannot
Was just looking at the ticket above to see if there was any response, there is not.
However I then noticed the LUA scripts I have previously created in the Vera mobile app have vanished.
If I edit one of the existing scenes, there does still appear to be some reference to a Lua script.
Also in the other Mios app, it looks like that LUA Scripts hasn’t been implemented at all as I cannot even see a “LUA Scripts” option under Settings.
UPDATE
Looking now my Lua scripts came back and are present and visible
Hello @cw-kid
We want to confirm that your comment on the case about the bug you found has been successfully added.
It is now under investigation.
Hello
Any update on this?
Can you provide an example of how to create a LUA script to send out a http request to another device on the LAN?
What is the correct recommended way to do this?
Thank you
Hello!
Unfortunately, we are still waiting for a resolution on the matter too.
Thank you for your understanding.
Regards.
Hi @cw-ki
We are not supporting luup commands in Ezlo hubs.
I will share here several examples of the plugins which interacting with external http sevices using hub’s http module.
Thanks
All I want to be able to do, is have a LUA Script and in there send out several HTTP requests using WGET.
If you can give me an example of that, that would be great.
There are several examples of plugins showing how to work with the HTTP Lua module on Ezlo 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 your favorite stocks.
To run it on your Ezlo Plus or Ezlo Secure you need:
/home/data/custom_plugins/
directory/opt/firmware/bin/ha-infocmd hub.extensions.custom_plugin.register http_test
to register the pluginhub.extensions.plugin.run
request with a script
parameter set to a HUB:http_test/scripts/http_request
/var/log/firmware/ha-luad.log
http_example_finance.zip (1.9 KB)
http_example_postman.zip (1.7 KB)
I need a plugin to just send out a HTTP request using WGET in a LUA script within a scene ?
In Vera in my LUA Script / scene, I just add one line like this:
luup.inet.wget("http://192.168.0.30:8765/?tablet=wake")
That sends out a HTTP Request to wake up one of my Android tablets.
How would you do the same in a LUA script on the Ezlo hub ?
Thanks
OK this command works in a LUA Script on an Ezlo hub
os.execute('wget http://192.168.0.30:8765/?tablet=wake')
However some of my other HTTP commands for sending TTS to Google Home aren’t working, need to figure out why.
I wanted to be able to send a HTTP command like this via a LUA Script on the Ezlo Plus.
http://192.168.0.4:1880/sceneTrigger?message=this%20is%20a%20test&ip=192.168.0.16
The command is sent to Node-Red which in turn makes my Google Home speaker say a TTS announcement.
However for the life of me I could not get it working and couldn’t get the format of the command correct.
I asked @rigpapa if he could assist me which he did, so kudos to him for getting this working.
Below is what he said and the now working command:
“The argument expected by os.execute is a string so it must always be surrounded in quotes. Additional (different) quotes may be needed within the string for proper shell escaping and quoting. Many of your examples won’t work because the string isn’t Lua quoted correctly and so not valid Lua.”
This has correct string quoting for Lua but may not work because the command within the string is not shell quoted and & is a shell special character. Corrected for shell:
os.execute("wget 'http://192.168.0.4:1880/sceneTrigger?message=this%20is%20a%20test&ip=192.168.0.16'")
And this also now works for curl:
os.execute ("curl 'http://192.168.0.4:1880/sceneTrigger?message=this%20is%20a%20test&ip=192.168.0.16'")
Thank you for keeping us posted @cw-kid. Very useful info
Best Home Automation shopping experience. Shop at Ezlo!
© 2024 Ezlo Innovation, All Rights Reserved. Terms of Use | Privacy Policy | Forum Rules