device time comstraint

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

Moderator: leecollings

Post Reply
mosjonathan
Posts: 40
Joined: Friday 24 February 2017 21:20
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

device time comstraint

Post 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
BakSeeDaa
Posts: 485
Joined: Thursday 17 September 2015 10:13
Target OS: Raspberry Pi / ODroid
Domoticz version:

Re: device time comstraint

Post 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.
Last edited by BakSeeDaa on Friday 03 November 2017 14:47, edited 1 time in total.
mosjonathan
Posts: 40
Joined: Friday 24 February 2017 21:20
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: device time comstraint

Post by mosjonathan »

Thanks, that works
dannybloe
Posts: 1355
Joined: Friday 29 August 2014 11:26
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Ermelo
Contact:

Re: device time comstraint

Post 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
	}
}
Creator dzVents - RPi3, loads of zwave devices, esp8266, evohome.
mosjonathan
Posts: 40
Joined: Friday 24 February 2017 21:20
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: device time comstraint

Post by mosjonathan »

Thanks
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest