Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Timers or Waits in events?
#1
With my ISY I have several programs that have a wait condition and if the status changes the wait is reset.  How would I do this with CQC?

ISY Program Example:
Code:
Family Room Lights - Off - [ID 0019][Parent 001E]

If
        'Family Room / FR Motion-Sensor' Status is Off
    And 'Family Room / FR-Desk.Motion' Status is Off

Then
        Wait  15 minutes
        Set 'Scenes / Family Room Lights' Off

Else
   - No Actions - (To add one, press 'Action')
Reply
#2
https://www.charmedquark.com/vb_forums/s...3#pid89033

I think this is discussing what I'm looking for however the images from that whole thread are not visible and the new function Dean mentions is not clear to me on how to use it. Being new sucks! Wink
Reply
#3
The cleanest way is to do this via the Timers Driver.  It is a driver that allows you to set or clear various timers.  I use this on my motion detection outside - If it is triggered, the timer will be activated, so the various tasks I have done during that activation will not be done again until the count down timer is down to 0.  this prevents the same commands from being executed until the countdown is completed.  the code below is within a trigger, and it sets a timer to 180 seconds, and sets a couple of variable driver fields to true during that time.  Once the timer goes to 0, I use another trigger to reset those variables to false.  I do that by watching for a field change of the timer field, and when it gets to 0x0, I runn another action that sets them back to false.

There is also a Wait command and Pause command within the action interface, but the length of time you are talking about, you would have that action tied up while waiting for that entire time.  I use those for 1 to 10 second wait periods.
Code:
Devices::FieldWrite
    P1=Timer.InvokeCmd
    P2=ResetCD 2 Seconds 180
    P3=True

Devices::FieldWrite
    P1=CQCVar.DrivewayMotion
    P2=True
    P3=False

Devices::FieldWrite
    P1=CQCVar.FrontMotion
    P2=True
    P3=False
Reply
#4
(01-04-2020, 10:22 PM)kblagron Wrote: The cleanest way is to do this via the Timers Driver.  It is a driver that allows you to set or clear various timers.  I use this on my motion detection outside - If it is triggered, the timer will be activated, so the various tasks I have done during that activation will not be done again until the count down timer is down to 0.  this prevents the same commands from being executed until the countdown is completed.  the code below is within a trigger, and it sets a timer to 180 seconds, and sets a couple of variable driver fields to true during that time.  Once the timer goes to 0, I use another trigger to reset those variables to false.  I do that by watching for a field change of the timer field, and when it gets to 0x0, I runn another action that sets them back to false.

There is also a Wait command and Pause command within the action interface, but the length of time you are talking about, you would have that action tied up while waiting for that entire time.  I use those for 1 to 10 second wait periods.
Code:
Devices::FieldWrite
    P1=Timer.InvokeCmd
    P2=ResetCD 2 Seconds 180
    P3=True

Devices::FieldWrite
    P1=CQCVar.DrivewayMotion
    P2=True
    P3=False

Devices::FieldWrite
    P1=CQCVar.FrontMotion
    P2=True
    P3=False

This is all a good beginning but I'm so new with CQC events I'm trying to understand the usage and how to use this information.
Reply
#5
Can someone baby step me through use of timers? Banging my head on this with a new install. I know it in HomeSeer and ISY but I'm too new to CQC and I don't understand things yet.
Reply
#6
If you just want to set a field to a value for a short period of time and then have it go to another value, you can use the TimedFldChange() command, which is in the same Devices:: target as the regular field write commands. You give it the field to write to, the initial value to write, a timeout, and the final value to write. It'll set the first value, wait for the indicated time, and then write the final value.

The nice thing about it is that, if something else writes to the field while it's waiting, the final value will be canceled, so you don't have to worry about it kicking in later.

If that's sufficient for what you want to do, then it's the best way to do it because it's the lightest weight and most controlled mechanism for that sort of thing. And it also is 'non-blocking', so it returns as soon as it has written the first value and you can continue on. The driver will do the final write itself when the time comes.
Dean Roddey
Explorans limites defectum
Reply
#7
(01-05-2020, 05:48 PM)Dean Roddey Wrote: If you just want to set a field to a value for a short period of time and then have it go to another value, you can use the TimedFldChange() command, which is in the same Devices:: target as the regular field write commands. You give it the field to write to, the initial value to write, a timeout, and the final value to write. It'll set the first value, wait for the indicated time, and then write the final value.

The nice thing about it is that, if something else writes to the field while it's waiting, the final value will be canceled, so you don't have to worry about it kicking in later.

If that's sufficient for what you want to do, then it's the best way to do it because it's the lightest weight and most controlled mechanism for that sort of thing. And it also is 'non-blocking', so it returns as soon as it has written the first value and you can continue on. The driver will do the final write itself when the time comes.
This sounds along the lines of what I'm looking for.  I have a few instances of this type of scenario and I'm still trying to wrap my head around CQC and the event structure of how to do this.

Here's some mockup of what I'm wanting as I don't know how to translate it yet into CQC

Trigger -> door closed
if fan is on
    stop/clear/reset timer
else
    cmd -> turn on fan

Trigger -> door opened
Timer -> wait 5 minutes

Trigger -> Timer End
cmd -> turn off fan


Essentially when someone enters the bathroom turn on the exhaust fan and when they leave set a timer to turn off the fan in 5 minutes.  If someone goes into the bathroom and the fan is on then leave it on and stop/reset/clear the timer to prevent the fan from turning off while they are in the bathroom.  Then when they leave/door opens start the timer again.  Then once the timer ends finally turn off the light.

I have several scenarios where I do this as I have several doors to the deck and if any one of them is opened then turn on the lights and set a timer for 10 minutes but if any of the doors are opened again then reset the timer... etc things like that.
Reply
#8
I haven't used the TimedFldChange()  command, that may be an easier way than using the timer driver.

What I do is:

  • Detect motion which sends an event trigger
  • If a field I created in a CQC Variables Driver is "False"
  • Set a countdown timer and then  write a "True" Value to that CQC Variables field
  • Perform any actions needed - in my case - turn on TV's, switch to Camera Output so it can be viewed.
  • Set another trigger on that countdown timer so that when the timer reaches 0 (0x0), it resets the CQC Variables Field to False
What this does is it allows me to pass over that motion detection if the timer is not 0, so that I don't send out additional commands when they have already been performed. 
Reply
#9
(01-05-2020, 11:29 PM)kblagron Wrote: I haven't used the TimedFldChange()  command, that may be an easier way than using the timer driver.

What I do is:

  • Detect motion which sends an event trigger
  • If a field I created in a CQC Variables Driver is "False"
  • Set a countdown timer and then  write a "True" Value to that CQC Variables field
  • Perform any actions needed - in my case - turn on TV's, switch to Camera Output so it can be viewed.
  • Set another trigger on that countdown timer so that when the timer reaches 0 (0x0), it resets the CQC Variables Field to False
What this does is it allows me to pass over that motion detection if the timer is not 0, so that I don't send out additional commands when they have already been performed. 

I've muddled my way through most of this.  With the timer in the field I only have Timer(1-5) options and CDTimer is not an option.  How do I use a Count Down Timer?  It's not showing as a field value in FieldWrite2.  Is this not v2 compliant maybe?
Reply
#10
You are probably using my simple counter driver, He's probably using the third party one (called RunTimer I think) which has more options. Look for that.
Dean Roddey
Explorans limites defectum
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Status of Scheduled and Triggered Events gReatAutomation 4 1,729 04-21-2020, 12:58 PM
Last Post: gReatAutomation
  Scheduled Events & Variables gReatAutomation 2 1,498 06-20-2019, 01:31 PM
Last Post: gReatAutomation
  your sched/triggered/tasker/IFTTT events IVB 17 9,836 01-18-2018, 07:41 AM
Last Post: RichardU
  Smart Handling of ISY Motion events Sendero 10 6,344 10-05-2016, 09:43 PM
Last Post: Dean Roddey
  EmailURLImg in Triggered Events TurboSam 6 3,875 11-23-2013, 01:50 PM
Last Post: Dean Roddey
  Variable Times for Triggered Events TurboSam 9 5,847 11-19-2013, 10:00 PM
Last Post: Dean Roddey
  Event Server - Scheduled Events DaveB 2 2,701 06-05-2011, 05:58 AM
Last Post: DaveB
  Scheduled events editor - howto request willplaice 2 2,247 05-30-2010, 04:12 PM
Last Post: jkish
  Newbie Question: How do I get event data for triggered events? Sendero 7 3,880 02-10-2009, 11:26 PM
Last Post: Dean Roddey
  Custom Heating control (like IVB's timers) willplaice 5 3,197 01-17-2009, 11:54 AM
Last Post: Dean Roddey

Forum Jump:


Users browsing this thread: 1 Guest(s)