Page 1 of 1

How to activate Armed Home or Away by lua and trigged by time?

Posted: Friday 24 March 2017 10:31
by iffen5
I want to activate "arm Home" at weekdays between 07:00 - 20:00 adn deactivate the rest of the time?

Have anyone did this before and can you share your script?

/Ingemar

Re: How to activate Armed Home or Away by lua and trigged by time?

Posted: Friday 24 March 2017 11:53
by jimtrout87
Hello,

i think this should to it... Although if you manually tried to arm away\disarm in the day it would auto set back to arm home. You could use a variable if this became a issue mind.

Code: Select all

time = os.date("*t")

commandArray = {}
 
if ( time.hour >=7 and time.hour <20 and otherdevices['Security Panel'] ~= 'Arm Away') then
	commandArray['Security Panel'] = 'Arm Home'
	elseif (time.hour >=20 and time.hour <7 otherdevices['Security Panel'] == 'Arm Away') then
	commandArray['Security Panel'] = 'Disarm'

end

return commandArray

Re: How to activate Armed Home or Away by lua and trigged by time?

Posted: Friday 24 March 2017 12:21
by Bikey
Even more flexible is to activate the arm home/away based on a virtual switch and then use the timer function on the switch to switch it on or of.

Re: How to activate Armed Home or Away by lua and trigged by time?

Posted: Tuesday 11 April 2017 15:20
by iffen5
Many thanks!
/Ingemar