Posts: 931
Threads: 38
Joined: Jun 2007
ea_automation Wrote:I'm not a home so this is from memory:
I have a trigger on the motion sensor feeding from the Elk.
Trigger if motionsensor = "Violated"
This triggers an event
If var_Sleeping Then
if light is out then
turn light on
end if
set countdown timer to 15 minutes
end if
This will reset the timmer everytime there is motion.
I then have a trigger on the countdown timer = 0
Countdown_Timmer = 0
turn light out.
==
I can post the code if interested when I get home tonight.
i took one of the TimedFldChange commands out of my code...now i only have TimedFldChange on the UPB driver. i thought that if i used the command for both elk and upb then both driver fields would be up to date. based on dean's comment maybe these two were working against each other. with only one TimedFldChange it seems to be working better, but still seeing a glitch on one upb device.
if your offer still stand, seeing a post of your code would be helpful. thanks.
Posts: 43
Threads: 6
Joined: Sep 2007
My application is a little different. I use it to turn off the bathroom exhaust fan.
S.O.O. [sequence of operation]
When the fan is used it should turn off after 5 minutes to remove the stink.
If it is on due to a shower I want it to remove humidity. Run until humidity is back to normal. (Problem - I have not been able to get my 1-wire system running on CQC. Until I can run for 5 minutes after the light goes out)
I have Three Triggered Events
"BathroomFanCheck"
"BathroomFanCountDown"
"BathroomFanShutdown"
Fan Check is used when the light is turned off
The light in the bathroom is dim able.
I have the Trigger set to "send an event on any value change"
The BathroomFanCheck
Filters:
New Fld Value Equals --> _Lights.BathroomLight --> 0
Fld Value Equals -->_Lights.BathroomFan --> True
"All True"
Actions:
"OnTrigger"
FieldWrite(_Timers1.InvokeCmd, ResetCD 3 Mintues 5)
When the light is turned out and the fan is running a countdown timer is set to 5 Minutes.
If anytime during this 5 minutes the light gets turned off again the countdown gets reset to 5 minutes.
The BathroomFanCountDown
The fan is an on/off switch.
I have the Trigger set to "send an event if the expression is true"
"IsTrue"
Filters:
Is Field Change For --> _Lights.BathroomFan
"All True"
Actions:
"OnTrigger"
FieldWrite(_Timers1.InvokeCmd, ResetCD 3 Mintues 5)
When the fan is turned on a countdown timer is set to 5 Minutes.
I check if the light is on during the actual shutdown routine since if someone is still in the bathroom I don't want to change the operation.
The BathroomFanShutdown
The count down timer
I have the Trigger set to "send an event if the expression is true"
"0"
Filters:
Is Field Change For --> _Timers1.CDTimer3
"All True"
Actions:
"OnTrigger"
FieldRead(_Lights.BathroomLight, LVar:ChkVlu,True)
If System::Equals(%(LVar:ChkVlu),0)
FieldWrite(_Lights.BathroomFan, False)
End
When the timer expires I check the light to see that it is off. If it is I turn the fan off. If it is not I leave it on - wait for the light to turn off and start the timer over.
Since I use the same timer for the light and the fan when either one changes the timer gets reset. The one thing that I could do to stop from sending a signal when not needed is check the fan status as well in the shutdown routine and if already off, someone turned it off, then do nothing. That would look like:
Actions:
"OnTrigger"
FieldRead(_Lights.BathroomLight, LVar:ChkVlu,True)
FieldRead(_Lights.BathroomFan, LVar:ChkVlu2,True)
If System::Equals(%(LVar:ChkVlu),0)
If System::Equals(%(LVar:ChkVlu2),True)
FieldWrite(_Lights.BathroomFan, False)
End
End
Sorry I took so long to respond. I'm BAD at keeping up with my messages and email. I have to automate to get it done timely.
Posts: 43
Threads: 6
Joined: Sep 2007
I should have read closer. You wanted motion:
I use this motion for a couple of different items.
1) night light
2) arming the alarm system when my kids, wife and me forget.
KitchenMotion
my elk zone that I monitor for a nightlight is Zone 11
Trigger is set to "Send an event on any value change"
Event Filters:
Fld Value Equals --> _Elk.LogZone011 --> Open
"All True"
Actions:
FieldRead(_Lights.KitchenClockLightDim, LVar:ChkVlu,True)
FieldWrite(_Timers1.InvokeCmd, ResetCD 6 Minutes 35)
If Not System::GrThan(%(LVar:ChkVlu),0)
If System::IsNight()
FieldWrite(_Lights.KitchenClockLightDim,81)
FieldWrite(_Timers1.InvokeCmd, ResetCD 5 Minutes 2)
End
End
Then the TimerCD 5 is set to turn off the light
TimerCD 6 is set to arm the alarm system if there has been no motion for 35 minutes and it is not the weekend and it is not a holiday and there is school and it is inbetween 7 am and 5 pm.