[LUA] asynchronous OpenURL call Topic is solved

Moderator: leecollings

Post Reply
tmunzer
Posts: 2
Joined: Sunday 28 March 2021 16:38
Target OS: Linux
Domoticz version:
Contact:

[LUA] asynchronous OpenURL call

Post by tmunzer »

Hi All,
After waiting a long time (nearly 2 years!) I upgraded - clean reinstall then reloading settings- Domoticz (running on a Armbian Buster Sunveil R69 TV Box).

Everything went fine, except for one LUA internal script. That script updates an LCD2004 panel associated with an ESP2866 Esp Easy., using a CommandArray with 5 OpenURL calls. The first one clearing the panel, the next four writing the four text lines.

With my old Domoticz version, successives OpenURL calls were synchronous and result was deterministic, but with last stable build, they looks like asynchronous : so the CLEAR command sent to the panel is sometimes executed first (with expected result) but most of the time it's not and lines written before the CLEAR are.. cleared!

Code: Select all

        commandArray[1]={['OpenURL'] = baseurlESPEasy..'CMD,clear' }
        commandArray[#commandArray + 1]={['OpenURL'] = baseurlESPEasy..',1,1,"'..space..space..jour..'"'}
        commandArray[#commandArray + 1]={['OpenURL'] = baseurlESPEasy..',2,1,"'..space..space..space..'DNS'..space..space..space..space..space..space..twopoints..space..otherdevices["Dns Resolution"]..'"'}
        commandArray[#commandArray + 1]={['OpenURL'] = baseurlESPEasy..',3,1,"'..space..space..space..'Internet'..space..twopoints..space..otherdevices["Google"]..'"'}
        commandArray[#commandArray + 1]={['OpenURL'] = baseurlESPEasy..',4,1,"'..space..space..space..'Serveur'..space..space..twopoints..space..otherdevices["Tatooine"]..'"'}
That code worked with my previous Domoticz version and still works sometimes, but is it possible to force synchronous OpenURL calls in LUA internal scripts ?
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: [LUA] asynchronous OpenURL call

Post by waaren »

tmunzer wrote: Sunday 28 March 2021 16:57 Is it possible to force synchronous OpenURL calls in LUA internal scripts ?
No.

but you could use the delay functionality of the event system.

Code: Select all

commandArray = {}

        commandArray[#commandArray + 1]={['OpenURL'] = baseurlESPEasy..'CMD,clear' }
        commandArray[#commandArray + 1]={['OpenURL'] = baseurlESPEasy..',1,1,"'..space..space..jour..'"' .. ' AFTER 0.2' }
        commandArray[#commandArray + 1]={['OpenURL'] = baseurlESPEasy..',2,1,"'..space..space..space..'DNS'..space..space..space..space..space..space..twopoints..space..otherdevices["Dns Resolution"]..'"' .. ' AFTER 0.4' }
        commandArray[#commandArray + 1]={['OpenURL'] = baseurlESPEasy..',3,1,"'..space..space..space..'Internet'..space..twopoints..space..otherdevices["Google"]..'"' .. ' AFTER 0.6' }
        commandArray[#commandArray + 1]={['OpenURL'] = baseurlESPEasy..',4,1,"'..space..space..space..'Serveur'..space..space..twopoints..space..otherdevices["Tatooine"]..'"' .. ' AFTER 0.8' }
        
return commandArray
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
tmunzer
Posts: 2
Joined: Sunday 28 March 2021 16:38
Target OS: Linux
Domoticz version:
Contact:

Re: [LUA] asynchronous OpenURL call

Post by tmunzer »

waaren wrote: Sunday 28 March 2021 19:38 but you could use the delay functionality of the event system.
Thank you. It does not work 100% as before upgrade but it's OK for me. Before asking for help, I did a quite extensive search looking for OpenURL syntax in Domoticz documentation, but found nothing related to LUA syntax, only for dzVents.
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: [LUA] asynchronous OpenURL call

Post by waaren »

tmunzer wrote: Sunday 28 March 2021 19:54 I did a quite extensive search looking for OpenURL syntax in Domoticz documentation, but found nothing related to LUA syntax, only for dzVents.
Understand. Will add something to the wiki.
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest