Posts: 341
Threads: 53
Joined: Nov 2018
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')
Posts: 341
Threads: 53
Joined: Nov 2018
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!
Posts: 1,498
Threads: 142
Joined: May 2007
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
Posts: 341
Threads: 53
Joined: Nov 2018
(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.
Posts: 341
Threads: 53
Joined: Nov 2018
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.
Posts: 40,483
Threads: 491
Joined: Aug 2002
01-05-2020, 05:48 PM
(This post was last modified: 01-05-2020, 05:50 PM by Dean Roddey.)
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
Posts: 341
Threads: 53
Joined: Nov 2018
(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.
Posts: 1,498
Threads: 142
Joined: May 2007
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.
Posts: 341
Threads: 53
Joined: Nov 2018
(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?
Posts: 40,483
Threads: 491
Joined: Aug 2002
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
|