Page 1 of 1
Q about dzVents syntax versus LUA
Posted: Friday 17 February 2023 23:06
by BartSr
Hi!
In a LUA script i have next (working) code:
Code: Select all
commandArray[1] = {['OpenURL']="http://192.168.2.56/cm?cmnd=Power%20On" }
return commandArray
This switches on a light in a Tasmota-flashed wifi switch.
Anyone who can advise me about the dzVents equivalent?
Thanks!
-Bart
Re: Q about dzVents syntax versus LUA
Posted: Saturday 18 February 2023 8:43
by jvdz
Wat is the trigger of this script?
Either way the Wiki describes it pretty nicely:
https://www.domoticz.com/wiki/DzVents:_ ... d_handling
Re: Q about dzVents syntax versus LUA
Posted: Saturday 18 February 2023 12:15
by BartSr
Thanks a lot jvdz, I overlooked this, maybe because of the the trailing get part.
I do succesfull
Code: Select all
domoticz.openURL({
url = "http://192.168.2.56/cm?cmnd=Power%20On" ,
-- method = 'GET',
-- callback = 'energyRetrieved'
})
Now I have another Q:
I do check if a device is alive using command:
Code: Select all
ping_success=os.execute('ping -c1 -w1 ' .. "192.168.2.200")
But I was advised this is not reliable due to the fact the device can be busy while pinged.
So I should ping several times with timedelay.
Now my Q: Can I give ping-command which will be delayed executed 3 times in sequence?
Thank you.
-Bart
Re: Q about dzVents syntax versus LUA
Posted: Saturday 18 February 2023 13:50
by jvdz
Just change the parameters on your ping command to try multiple times. Guess that would be the easiest?
...but you can also try it multiple times with an loop.
The thing to remember is that you will hold up the eventsystem in case your script takes seconds to process all of this.