Page 1 of 1

device time comstraint

Posted: Thursday 02 November 2017 8:57
by mosjonathan
Hello

i'm trying to make a device trigger only between 21:30 and 03:00 and have done it in the way shown in the code but the script is never triggered.

Code: Select all

return {
    active = true,
	on = {
	      ['PowerOff'] = {'between 21:30 and 03:00'}
	     },
	execute = function(domoticz, device)

		if domoticz.devices('PowerOff').state == 'On' and domoticz.devices('Naar bed').state == 'Off' then

Re: device time comstraint

Posted: Thursday 02 November 2017 11:15
by BakSeeDaa
Try

Code: Select all

{'at 21:30-03:00'}
I'm not sure but the following might work too:

Code: Select all

{'between 21:30 and 23:59', 'between 00:00 and 03:00'}
EDIT: Added missing quotes.

Re: device time comstraint

Posted: Thursday 02 November 2017 12:12
by mosjonathan
Thanks, that works

Re: device time comstraint

Posted: Friday 03 November 2017 12:38
by dannybloe
Your on-section is not correct:

Code: Select all

on = {
	devices = {
		['PowerOff'] = {'between 21:30 and 03:00'}
	}
}
If you want multiples:

Code: Select all

on = {
	devices = {
		['PowerOff'] = {'between 21:30 and 03:00', 'between 00:00 and 03:00'} -- this example overlaps
	}
}

Re: device time comstraint

Posted: Friday 03 November 2017 14:20
by mosjonathan
Thanks