Q about dzVents syntax versus LUA

Easy to use, 100% Lua-based event scripting framework.

Moderator: leecollings

Post Reply
BartSr
Posts: 491
Joined: Sunday 03 July 2016 16:16
Target OS: Raspberry Pi / ODroid
Domoticz version: V2024.7
Location: Netherlands
Contact:

Q about dzVents syntax versus LUA

Post 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
Raspberry pi 3b
Arduino
KAKU
RfxCom
Zwave2MQTT
OTGW
Chinese sensors temp (Dallas),movement
Tasmota
Esp8266 / 32 espeasy
Zigbee2MQTT
User avatar
jvdz
Posts: 2446
Joined: Tuesday 30 December 2014 19:25
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.107
Location: Netherlands
Contact:

Re: Q about dzVents syntax versus LUA

Post 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
BartSr
Posts: 491
Joined: Sunday 03 July 2016 16:16
Target OS: Raspberry Pi / ODroid
Domoticz version: V2024.7
Location: Netherlands
Contact:

Re: Q about dzVents syntax versus LUA

Post 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
Raspberry pi 3b
Arduino
KAKU
RfxCom
Zwave2MQTT
OTGW
Chinese sensors temp (Dallas),movement
Tasmota
Esp8266 / 32 espeasy
Zigbee2MQTT
User avatar
jvdz
Posts: 2446
Joined: Tuesday 30 December 2014 19:25
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.107
Location: Netherlands
Contact:

Re: Q about dzVents syntax versus LUA

Post 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.
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest