Page 1 of 1

Re: problems launching php scripts with dzVents  [Solved]

Posted: Thursday 29 August 2019 19:15
by waaren
miki8989 wrote: Thursday 29 August 2019 16:11 I have a problem creating a dzVents that launches a php script
he script doesn't start and I don't see any LUA activity in the logs
Can you try

Code: Select all

return 
{
    active = true,
    on = 
    { 
    	timer         = { "every minute" },
    },
       execute = function(domoticz)
	   os.execute ('/var/www/MyScripts/rete.php &')
      end
}

Re: problems launching php scripts with dzVents

Posted: Thursday 29 August 2019 23:41
by waaren
miki8989 wrote: Thursday 29 August 2019 21:38 ..but if i wanted to start the script every 15 seconds ??
It is possible to do this but only with kind of a trick, using a delayed action on a virtual device or delayed call to openurl . Find below an example with a virtual device (type switch) that you will have to define in domoticz before first execution.

Code: Select all

return 
{
    on = 
    { 
    	timer = { 'every 10 minutes' },
        devices = { 'myTrigger' }, -- define this as virtual switch on dummy hardware first. Can be any valid name
    },

       execute = function(dz, item)
            trigger = dz.devices('myTrigger')  
            if item.isTimer then
                for delay=0,545,15 do
                    trigger.switchOn().afterSec(delay)
                end
            else
                os.execute ('/var/www/MyScripts/rete.php &')
            end
      end
}

Re: problems launching php scripts with dzVents

Posted: Friday 30 August 2019 13:59
by waaren

miki8989 wrote: if I wanted every 10 seconds I should put

Code: Select all

for delay=0,550,10 do
every 20 seconds

Code: Select all

for delay=0,540,20 do
Yes, you got the picture.





Re: problems launching php scripts with dzVents

Posted: Friday 30 August 2019 19:06
by waaren

miki8989 wrote:sorry for the picture of what ??
https://www.macmillandictionary.com/dic ... he-picture
Image