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

Moderator: leecollings

Post Reply
iffen5
Posts: 12
Joined: Tuesday 17 January 2017 11:59
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

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

Post 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
jimtrout87
Posts: 16
Joined: Tuesday 12 April 2016 17:16
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

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

Post 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
Bikey
Posts: 331
Joined: Sunday 22 February 2015 12:19
Target OS: Linux
Domoticz version: 2020.x
Location: Netherlands
Contact:

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

Post 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.
iffen5
Posts: 12
Joined: Tuesday 17 January 2017 11:59
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

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

Post by iffen5 »

Many thanks!
/Ingemar
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest