Page 1 of 1
openURL cancelQueuedCommands
Posted: Monday 12 December 2022 18:07
by barts2108
In a dzVents script I can make a call like
Code: Select all
execute = function(dz, device)
dz.openURL({
url = 'http://192.168.199.20:8080/json.htm?type=command¶m=switchlight&idx=71&switchcmd=On',
method = 'GET',
callback = ''
}).afterSec(30)
end
how can I cancel this afterSec(30) if something happens before the 30 seconds expired, I want to cancel the openURL.
dz.cancelQueuedCommands()
or
dz.openUrl({...}).cancelQueuedCommands()
give an error.
Re: openURL cancelQueuedCommands
Posted: Monday 12 December 2022 18:18
by plugge
afterSec() is not available for openURL
See the manual:
For commands for which dzVents must use openURL, only at() and afterAAA() methods are available.
But, I don't know if cancelQuedCommands() is available with afterAAA().
Re: openURL cancelQueuedCommands
Posted: Monday 12 December 2022 18:22
by willemd
You are making a json call to domoticz using openURL?
Why not use device.switchOn() within dzVents? At least the documentation states that the device.switchOn() command supports command options, including cancelQueuedCommands().
Note 2 states: "for domoticz.openURL() only at(), afterAAA() and withinAAA() is available", so I guess that the switchOn() is implemented in a different way.
Re: openURL cancelQueuedCommands [Solved]
Posted: Monday 12 December 2022 19:09
by waltervl
If you want an external device to be switched on/off with an url and use it in a dzvents script you can also make a virtual switch device and put the on/off urls in the action links. Then you can use that .aftersec() and cancelqueue as designed on the virtual switch.
Re: openURL cancelQueuedCommands
Posted: Monday 12 December 2022 20:05
by barts2108
Indeed I want to call another (second) Domoticz system
Some time after posting creating the virtual switch also came into my mind. Will give that a try.
Re: openURL cancelQueuedCommands
Posted: Monday 12 December 2022 22:40
by waltervl
You don't have device sharing set up? Because then you can control the devices of the 2nd Domoticz setup in the first.
See wiki
https://www.domoticz.com/wiki/Setting_up_Device_sharing