Posts: 1,275
Threads: 135
Joined: Dec 2010
Im just now delving into events and I want to create an event to mimick a sleeper timer for my tv/reciever/etc
I tried to search the forum for an example but no such luck. can someone point me to one? Or perhaps just give me a simple explaination.
Thanks
Posts: 40,483
Threads: 491
Joined: Aug 2002
I don't know if you'll find an exact example, but the easiest way would be something like:
1. Install the timer driver. Create at least one count down timer channel.
2. Set up a trigger on one of the power fields of the devices you are powering on
3. Set up a triggered event on that power field (going to true) that sets the count down timer to some value, like 4 hours or something
4. Set up a trigger on that count down field that pops when the timer goes to zero
5. Set up a triggered event on that count down timer field that just powers off the devices.
Something along those lines. If you want you can have a variables driver boolean field that is used as a manual override, and the #5 event above will check that and not do anything if the override field is True.
Dean Roddey
Explorans limites defectum
Posts: 1,275
Threads: 135
Joined: Dec 2010
Ok. Ill give that a try.
What i had done so far was use the timedfldchange to change the value of a variables driver field from false to true. that was working. i then configured a trigger event to run the shutdown code when the fld changed to true, but nothing is happening.
is my solution flawed?
Posts: 40,483
Threads: 491
Joined: Aug 2002
zra Wrote:Ok. Ill give that a try.
What i had done so far was use the timedfldchange to change the value of a variables driver field from false to true. that was working. i then configured a trigger event to run the shutdown code when the fld changed to true, but nothing is happening.
is my solution flawed?
Did you set up the variables driver field to send out a trigger when it changes to the desired value? Fields only send out triggers if configured. If every field sent out a trigger evey time it changed, it would kind of destroy the system. So you have to configure fields to send out triggers that you can trigger events from.
Dean Roddey
Explorans limites defectum
Posts: 1,275
Threads: 135
Joined: Dec 2010
Dean Roddey Wrote:Did you set up the variables driver field to send out a trigger when it changes to the desired value? Fields only send out triggers if configured. If every field sent out a trigger evey time it changed, it would kind of destroy the system. So you have to configure fields to send out triggers that you can trigger events from.
I did, Dean. I was sending it out (istrue). So the variable<system.shutdown> is set to false by default and then i set it to change to true with the timedfldchange. on the trigger event side i was setting up the number one filter (FldValEquals) to my variable driver <systemstate.shutdown> and the comp value <true>
is that make any sense?
Posts: 40,483
Threads: 491
Joined: Aug 2002
zra Wrote:I did, Dean. I was sending it out (istrue). So the variable<system.shutdown> is set to false by default and then i set it to change to true with the timedfldchange. on the trigger event side i was setting up the number one filter (FldValEquals) to my variable driver <systemstate.shutdown> and the comp value <true>
is that make any sense?
Make sure the trigger is going out. Open the CQC Command Prompt and run the CQCEventDump program. It'll dump out any event triggers that are being sent out, and make sure you see the trigger going out first.
Dean Roddey
Explorans limites defectum
Posts: 1,275
Threads: 135
Joined: Dec 2010
So I used some simple test code to run in the event of the trigger and that worked, so obviously something wrong with my code at least in the context of the event triggering system(are there limitations?), but the event system appears to be working.
the code i used that worked was to turn off my squeezebox
one thing i noticed was that the event trigger continues to run the code because i was unable to simply turn the squeezebox back on. it kept turning off until i paused the trigger. is that normal functionality? what i want to do is make it so the trigger executes only once. do i need to add code to reset or pause the trigger?
i also noticed that the timedfldchange appeared to need some sort of reset. is that correct? if so what is the best way to do that? or perhaps i should take your advice and install the timer driver? is that a better mechanism?
Posts: 1,275
Threads: 135
Joined: Dec 2010
after some more experimenting things are working a little better. ill have to keep testing to see why the squeezebox power gets stuck in power off. i tried more simple power off commands on some of my other devices disregarding all the code that is in my IV power off command and they are now working. i dont seem to have the "stuck" issue that i was having with the squeezebox.
Posts: 40,483
Threads: 491
Joined: Aug 2002
Any write to the field will cancel the timed field change, so that may be what is happening. It's assumed that if you explicitly write any value to the field, that you are wanting to override the timed change. The timer driver is probably a bit better for that kind of thing. The timed field change is more for things like turning on a light for five minutes and whatnot.
Dean Roddey
Explorans limites defectum
Posts: 1,275
Threads: 135
Joined: Dec 2010
Dean,
Does the event server have access to global variables? Can i test for values in the action area of the event server?