We have moved at community.getvera.com

Author Topic: A SCENE THAT ONLY HAPPENS BETWEEN 10 PM AND 7 AM  (Read 1149 times)

bedy

  • Guest
A SCENE THAT ONLY HAPPENS BETWEEN 10 PM AND 7 AM
« on: November 13, 2013, 01:18:08 pm »
I have tried to do the following that seems very simple but I simply can?t:

I want that when a door sensor is opened, the lights of a room turn on and a receive an e-mail alert. BUT I WANT THIS TO HAPPEN ONLY BETWEEN 10 PM and 6 AM and here is where I simply can?t find a clue.

Thanks in advance for your help


Offline Crismaison

  • Sr. Member
  • ****
  • Posts: 451
  • Karma: +2/-0
Re: A SCENE THAT ONLY HAPPENS BETWEEN 10 PM AND 7 AM
« Reply #1 on: November 13, 2013, 02:15:30 pm »
Create a scene which arms the sensor at 10 pm with a trigger which is sending an email when the armed sensor is tripped. Create another scene with a schedule at 7 am which disarms the sensor
Vera lite - Everspring smoke & flood detectors - Fibaro doorsensors - 2 Foscams - Greenwave 6 node smartplug - Several Switches -Netatmo - PLEG - Twilio - DropBoxuploader - FindmyIphone user

Offline duiffie

  • Full Member
  • ***
  • Posts: 126
  • Karma: +2/-0
Re: A SCENE THAT ONLY HAPPENS BETWEEN 10 PM AND 7 AM
« Reply #2 on: November 21, 2013, 09:19:12 am »
Or use the PLEG plugin and:

- Add a PLEG schedule that is true at 10pm and becomes false at 7am (name it: At_Night)
- Add a PLEG trigger for the tripped door sensor (name it: Door_Opened)
- Add a PLEG condition (name it: Lights_On): (Door_Opened AND At_Night)

- Create a scene which turns your light(s) on and sends the email; add the PLEG device as a trigger (condition: Lights_On)
« Last Edit: November 21, 2013, 09:20:55 am by duiffie »
Vera2 (1.5.622)

Offline Bart

  • Newbie
  • *
  • Posts: 5
  • Karma: +0/-0
Re: A SCENE THAT ONLY HAPPENS BETWEEN 10 PM AND 7 AM
« Reply #3 on: November 21, 2013, 11:57:51 am »
I used this script for something similar:

Code: [Select]
local currentHour = os.date('*t').hour
if (7 <= currentHour) and (currentHour < 22) then
  return true
else
  return false
end

Offline RichardTSchaefer

  • Community Beta
  • Master Member
  • ******
  • Posts: 10091
  • Karma: +764/-143
Re: A SCENE THAT ONLY HAPPENS BETWEEN 10 PM AND 7 AM
« Reply #4 on: November 21, 2013, 02:10:12 pm »
I think you need something like:

Code: [Select]
local currentHour = os.date('*t').hour
return (7 > currentHour) or (currentHour >= 22)

or:
Code: [Select]
local currentHour = os.date('*t').hour
if (7 <= currentHour) and (currentHour < 22) then
  return false
else
  return true
end
« Last Edit: November 21, 2013, 02:19:32 pm by RichardTSchaefer »