Author |
|
jeffw_00 Super User
Joined: June 30 2007
Online Status: Offline Posts: 929
|
Posted: November 20 2007 at 11:32 | IP Logged
|
|
|
So I have some timed events that only occur on weekdays. However, on certain weekdays (like holidays, or just days I take off from work) I don't want these events to fire. Is there a way to go to my PC, and press a key-combo (or click on a PH command, or whatever), and tell PH "tomorrow (and only tomorrow), DO NOT execute this subset of timed commands". Another solution would be "Tomorrow (and only tomorrow), execute this additional set of timed commands that will fire right after the ones I want to cancel, essentially negating them".
Thanks
/j
|
Back to Top |
|
|
bhlonewolf Senior Member
Joined: March 29 2007
Online Status: Offline Posts: 198
|
Posted: November 20 2007 at 12:07 | IP Logged
|
|
|
There's a number of ways to do this. While there's no single magic button to do it, this will likely illustrate the power of what you can do ... so here's what I do for a similar situation which you can adapt.
- Create a global variable called "Away", set it to either 0 or false. (1 or true, whichever you prefer, would mean you're away from the home.)
- How you update this value is up to you. You can set up a control center button, which you can access over the web. I personally have a KPL button that does this. You can do email, socket server, etc.
- In the timed events, simply write the formula to check if "away = 1" then [turn on/off whatever you want to happen] My formula looks like this:
if ({AWAY}=1, ph_insteon("LR - READING LIGHT",ioff,0) ,0)
The advantage of this approach is that I can easily see via the KPL button on the back door as to whether away is set. To update the away variable via a KPL button, you'd simply have a trigger that responds to the on/off press of that button, then updates the variable.
|
Back to Top |
|
|
jeffw_00 Super User
Joined: June 30 2007
Online Status: Offline Posts: 929
|
Posted: November 20 2007 at 12:11 | IP Logged
|
|
|
Ah- I get the paradigm - thanks! Now I need to ramp up on the equations...
So what I might do is -set- AWAY manually occasionally, but always have it clear at midnight - i assume I can set a timed event to do this.
/j
Edited by jeffw_00 - November 20 2007 at 12:11
|
Back to Top |
|
|
onhiatus Senior Member
Joined: May 12 2004 Location: United States
Online Status: Offline Posts: 279
|
Posted: November 20 2007 at 12:11 | IP Logged
|
|
|
Easiest way is to just maintain a global variable. Something called RunSchedule - set it to 0 when you are home. Have the first line of each macro that is scheduled check the variable and exit if it's not equal to 0.
Then reset the variable at midnight - or however you want your "day off" to reset. You could make the reset logic as tricky as you want (automatically set it to 0 on weekends, and it could check a calendar somewhere to determin other days you are going to be home).
I actually do the above with a virtual X10 device. That way I can toggle it from a normal X10 switch.
Hope this helps, Tony
|
Back to Top |
|
|
jeffw_00 Super User
Joined: June 30 2007
Online Status: Offline Posts: 929
|
Posted: November 20 2007 at 12:12 | IP Logged
|
|
|
ooh - i like the idea of using an X-10 command to set it. can you give me a bit more detail as to how this ties to the variable?
/j
|
Back to Top |
|
|
onhiatus Senior Member
Joined: May 12 2004 Location: United States
Online Status: Offline Posts: 279
|
Posted: November 20 2007 at 17:22 | IP Logged
|
|
|
Easy. You just have a x10 module set up in Powerhome that doesn't really exist in your house. Now when you turn on this "virtual" x10 device powerhome has its status. At the begining of each macro check the status of the x10 device instead of the global variable.
So for the first line of your macro have something like:
Jump - if((ph_getx10stat("MY_VIRTUAL_DEVICE")=1),1,999)
|
Back to Top |
|
|
bhlonewolf Senior Member
Joined: March 29 2007
Online Status: Offline Posts: 198
|
Posted: November 20 2007 at 17:53 | IP Logged
|
|
|
Can you set up virtual Insteon devices?
|
Back to Top |
|
|
jeffw_00 Super User
Joined: June 30 2007
Online Status: Offline Posts: 929
|
Posted: November 20 2007 at 22:14 | IP Logged
|
|
|
Onhiatus Tony - can you give me a bit more of a step-by-step? I think I want to do the steps below, but where the ? are are things I don't know..
1) create a global variable (do I need a formula?)
2) in appropriate macros, I want to test the variable and exit (I saw the formula you posted but I'm unclear - is MY_VIRTUAL_DEVICE the global variable, or maybe I don't need one, just a virtual X-10 device? or ??)
3) I want to make a 'virtual X-10" device that corresponds to the variable??? (i.e., turning the device on sets the variable). Then I can set it from the Device-status window
4) I want to schedule to clear the variable at midnight every day.
I've read through the manual but a few examples would clarify things tremendously. I think you've given me almost what I need, a -little- more detail would be great, and once I understand the paradigm I will be comfortable applying it elsewhere.
/eager-to-learn 8-}
/j
Edited by jeffw_00 - November 20 2007 at 22:16
|
Back to Top |
|
|
jeffw_00 Super User
Joined: June 30 2007
Online Status: Offline Posts: 929
|
Posted: November 21 2007 at 11:46 | IP Logged
|
|
|
oops - just realized this is a bit more difficult, as i only want to run the test in the macro if the macro was called as a timed event, and NOT if it was called as a trigger. - still can do it?
/j
|
Back to Top |
|
|
cmhardwick Senior Member
Joined: July 08 2006 Location: United States
Online Status: Offline Posts: 290
|
Posted: November 21 2007 at 14:21 | IP Logged
|
|
|
would hte same macro be called via BOTH methods? if not, just put the test in the timed event macros.
__________________ Cicero, Enjoying automation!
|
Back to Top |
|
|
jeffw_00 Super User
Joined: June 30 2007
Online Status: Offline Posts: 929
|
Posted: November 21 2007 at 14:23 | IP Logged
|
|
|
yes, same macro both methods, otherwise it wouldn't really be a problem, would it? 8-}
thanks
/j
|
Back to Top |
|
|
dhoward Admin Group
Joined: June 29 2001 Location: United States
Online Status: Offline Posts: 4447
|
Posted: November 21 2007 at 14:50 | IP Logged
|
|
|
Couple of ways of doing this...
What I would do is just add a few extra lines to the beginning of each of these dual purpose macros. It would look like this:
10 Goto Label "[LOCAL1]"
20 Goto Label "START"
30 Label TIMEDEVENT
40 Your Timed Event check critera
50 ...
60 Label START
70 ...
Then in your timed events, change the action from macro to "Raw Formula" and use the following formula:
ph_macroparm("YOUR_MACRO_ID","TIMEDEVENT",0,0,0,0)
What happens is that calling a macro with ph_macroparm will pass in values to [LOCAL1] thru [LOCAL5]. In the above, we're setting [LOCAL1] to "TIMEDEVENT" if we're calling from within a timed event. Calling a macro any other way will typically have an empty string in [LOCAL1] (or some value other than TIMEDEVENT).
In the macro, the very first line attempts to transfer control to the label contained within [LOCAL1]. If we called with our ph_macroparm function, then control will transfer to line 30 and execute our Timed Event checks to see if we should continue or not. If we don't have a matching label to Goto, then control transfers to the next line (line 20). This line says to jump to the label START. This will transfer control to line 60 and bypass the checks for a timed event.
HTH,
Dave.
|
Back to Top |
|
|
onhiatus Senior Member
Joined: May 12 2004 Location: United States
Online Status: Offline Posts: 279
|
Posted: November 21 2007 at 16:12 | IP Logged
|
|
|
This is not to difficult. Create the X10 device and just use it - don't bother with a global variable. (If you did want to create a global variable you can do it through the explorer)
So answers:
1) Not needed
2) MY_X10_DEVICE was the virtual x10 device. I don't have powerhome in front of me, but just set it up as an appliance module so there are only three possible states (on, off, unknown).
3) You can set the (virtual) X10 device on / off from the x10 status window, or via a formula (see #4)
4) Create a daily timmed event that runs a formula at midnight. The formula should be something like:
ph_x10btn ( "MY_VIRTUAL_DEVICE", 3, 0 )
This sets the virtual device to off, so assumes that the device being on means don't run the macros.
So now the first line of each macro that you want to be conditional should be a jump statement with the following formula:
if((ph_getx10stat("MY_VIRTUAL_DEVICE")=1),2,999)
(if the device is on jump 999 steps)
Now you can set your "at home" mode by clicking an x10 button / remote that is set to the same address as your virtual device, or clicking on the x10 status screen, or running a formula (ph_x10btn ( "MY_VIRTUAL_DEVICE", 2, 0 ))
Hope this was clear enough...
|
Back to Top |
|
|
jeffw_00 Super User
Joined: June 30 2007
Online Status: Offline Posts: 929
|
Posted: November 22 2007 at 13:10 | IP Logged
|
|
|
Thanks guys - I appreciate the detail. Will give it a try soon.
|
Back to Top |
|
|
jeffw_00 Super User
Joined: June 30 2007
Online Status: Offline Posts: 929
|
Posted: November 22 2007 at 21:41 | IP Logged
|
|
|
Ok - a couple of followup
If I took Dave's suggestion, I assume I could embed all this 'gating' code in a macro so I have to add only one additional line to the macros I want to block? I think the answer is yes, as long as I use the same format Dave specified to call the common macro so that the parameter gets passed...."
However, the easier route, I think, is to use bhlonewolf's first suggestion. So I created a global variable, and macros to set and clear the variable, and entered a timed event to clear it once a day, and for the timed events that I wanted to be subject to the variable, I replaced their macro calls with formulas of the form
if ({AWAY}=1, ph_macro("macroname")
So the only thing left is a way to set the variable. For now I will create a control panel button that calls the set macro, (although I could use a real X-10 command to execute the set macro), Though, it would be real nice to control it from the device status window. But then I think I would have to replace the global variable with a virtual X10 device, which would prevent me from using the simple one-line substitution (the formula above) in the Timed Events window ( because I don't think there is any function of the form ph_test_x10_and_then_execute_macro("x1 0-device","macroname")
) ..
or is there? 8-}
and if there isn't - is there a way to create a status indicator on the control panel that would show the current value of a global variable?
I think i'm catching on, BTW - thanks for all the help
/j
Edited by jeffw_00 - November 22 2007 at 22:27
|
Back to Top |
|
|
TonyNo Moderator Group
Joined: December 05 2001 Location: United States
Online Status: Offline Posts: 2889
|
Posted: November 22 2007 at 22:31 | IP Logged
|
|
|
You could do this...
if( [X10STATQ1]=2, ph_macro("macroname"), "")
Replace Q1 with your X10 device code.
|
Back to Top |
|
|
jeffw_00 Super User
Joined: June 30 2007
Online Status: Offline Posts: 929
|
Posted: November 22 2007 at 22:34 | IP Logged
|
|
|
Thanks Tony!
Hey, is there a reason I keep getting logged out of this forum? Is there like a timeout?
/j
|
Back to Top |
|
|
TonyNo Moderator Group
Joined: December 05 2001 Location: United States
Online Status: Offline Posts: 2889
|
Posted: November 22 2007 at 23:09 | IP Logged
|
|
|
I don't think it can be fixed.
|
Back to Top |
|
|
jeffw_00 Super User
Joined: June 30 2007
Online Status: Offline Posts: 929
|
Posted: November 23 2007 at 00:23 | IP Logged
|
|
|
Tony - How do I get PH to check my syntax of formulas? I mean, I -think- this is right.
if ({SLEEPIN}=0, ph_macro("BEDROOM2SOUNDOFF"),0)
but I'm guessing. (should the compare be = or == ?) I just noticed that PH doesn't check formulas for syntax when you type them in...
thanks!
/j
|
Back to Top |
|
|
JustAnotherJoe Newbie
Joined: January 22 2007
Online Status: Offline Posts: 16
|
Posted: November 23 2007 at 02:31 | IP Logged
|
|
|
jeffw_00 wrote:
Thanks Tony!
Hey, is there a reason I keep getting logged out of this forum? Is there like a timeout?
/j |
|
|
Jeff, I seem to stay logged in from session to session. Make sure you cookies enabled for this site.
__________________ Just Another Joe
|
Back to Top |
|
|