Author Topic: Alerts run ALL THE TIME, not just during scene.  (Read 133 times)

Offline GadgetGirl

  • Newbie
  • *
  • Posts: 1
  • Karma: +0/-0
Alerts run ALL THE TIME, not just during scene.
« on: December 30, 2017, 11:43:16 am »
Not sure if I am doing something wrong, or if it's a software limitation. I have several different 'motion detection triggers lighting' scenes for different times of day. I wanted to get an email if a particular scene runs so I can see if teens are going to bed much later than they say they are. I have the LUA code set to run that scene between 1:30am and 5:38am.

"Whenever MotionSensor1 detects motion whether is armed or disarmed
Immediately Landing Bulb Level 20%
Wait for 1 min 30sec and then Landing Bulb Off
This scene runs when I am in any mode
When this scene runs notify these people (me)
Also execute the following Luup Code:

local pStart = "01:30"   -- Start of time period
local pEnd = "05:38"     -- End of time period
local allow = true       -- true runs scene during period, false blocks it
local hS, mS = string.match(pStart,"(%d+)%:(%d+)")
local mStart = (hS * 60) + mS
local hE, mE = string.match(pEnd,"(%d+)%:(%d+)")
local mEnd = (hE * 60) + mE
local tNow ="*t")
local mNow = (tNow.hour * 60) + tNow.min
if mEnd >= mStart then
     return (((mNow >= mStart) and (mNow <= mEnd)) == allow)
     return (((mNow >= mStart) or (mNow <= mEnd)) == allow)

This scene is one of four scenes on a 3 bulb (stairs and hall) thing. One is for daytime, one is for evening (all lights, but lower level), one is for bedtime (not the light outside a bedroom) and one is for very late at night (just the landing bulb, at 20%) All scenes run when they should so far; I wrote their Luup codes to have a 2 minute gap between scenes because I've noticed that the Vera (Vera Plus) has trouble keeping it's clock updated. I'm just having problems with the alerts on the last one.

If I go into "and notify this user" it will email me when the motion detector is tripped. Except it notifies me when the motion detector is tripped at any time, not just during that scene.

Secondary issue: I get emails every second that the motion detector (Fibaro FGMS-001) is detecting motion. I lost the paper insert to it, but I think I remember it being possible to set it to not activate after so many minutes after activating initially.

What am I doing wrong?