openURL cancelQueuedCommands  [Solved]

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

Moderator: leecollings

Post Reply
User avatar
barts2108
Posts: 25
Joined: Wednesday 17 June 2020 18:31
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: Arnhem
Contact:

openURL cancelQueuedCommands

Post 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&param=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.
plugge

Re: openURL cancelQueuedCommands

Post 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().
willemd
Posts: 621
Joined: Saturday 21 September 2019 17:55
Target OS: Raspberry Pi / ODroid
Domoticz version: 2024.1
Location: The Netherlands
Contact:

Re: openURL cancelQueuedCommands

Post 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.
User avatar
waltervl
Posts: 5149
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2024.7
Location: NL
Contact:

Re: openURL cancelQueuedCommands  [Solved]

Post 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.
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
User avatar
barts2108
Posts: 25
Joined: Wednesday 17 June 2020 18:31
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: Arnhem
Contact:

Re: openURL cancelQueuedCommands

Post 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.
User avatar
waltervl
Posts: 5149
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2024.7
Location: NL
Contact:

Re: openURL cancelQueuedCommands

Post 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
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest