Page 1 of 1

Problem with script not working with some of the triggers

Posted: Saturday 21 September 2019 18:29
by wayfinder
This script triggers but the light will only switch with the 'at 9:08' trigger.
I can tell its triggering at sunset and sunrise buy the dz.log('V mode OFF ' ) output in the log.

Any clues appreciated. Thanks in advance.

Code: Select all

return {
	
	on = {
		['timer'] = {
			'at sunset',
			'at sunrise',
			'at 9:08'
			
		}
	},
	logging = {
            level = domoticz.INFO,
            marker = "FFL Random"
       },
	execute = function(dz, trigger)

			local FFL = dz.devices(67)
			local RANDOM = 20
            local ON_MIN = 70
		    FFL.cancelQueuedCommands()

		if (dz.devices(34).state == 'Off') then  
		    dz.log('V mode OFF ' )
				FFL.switchOn().withinMin(RANDOM).forMin(ON_MIN)
		
			end

		
	end
}

Re: Problem with script not working with some of the triggers

Posted: Saturday 21 September 2019 20:40
by waaren
wayfinder wrote: Saturday 21 September 2019 18:29 This script triggers but the light will only switch with the 'at 9:08' trigger.
I can tell its triggering at sunset and sunrise buy the dz.log('V mode OFF ' ) output in the log.
Any clues appreciated. Thanks in advance.
Don't see any reason in this script why it should not do the random switchOn at sunset and at sunrise. Could be that the cancelQueuedCommands() at 9:08 or from another script kiks in before the withinMin() timer ends but hard to tell without analyzing the complete log and other scripts.
You can test that the switchOn() is activated at sunset / sunrise by removing the withinMin() part. If really important you can also switch on Debug mode in dzVents and domoticz.

BTW domoticz.INFO should domoticz.LOG_INFO

Re: Problem with script not working with some of the triggers

Posted: Saturday 21 September 2019 23:24
by wayfinder
I think you are correct on the cancelQueuedCommands(). I'll see tonight. I had it in another script I started by copying this one and never removed it.

Thanks