Author |
|
smarty Super User
Joined: May 21 2006 Location: United States
Online Status: Offline Posts: 728
|
Posted: November 05 2008 at 09:39 | IP Logged
|
|
|
Let me first say that I am aware of the Timed Events issues when trying to select a macro (as the type of timed event). I am using a RAW FORMULA type of timed event.
After I globally enable Timed Events, there are certain times I would like to disable individual Timed Events. I am trying to do so using the "ph_modifytimedevent" command. I am not sure I understand how to use it.
For example, the line below:
ph_modifytimedevent("messagebox",0,today(),4)
should "disable" the timed event called "messagebox". However, the "x" in the disabled check box never shows up, and the Timed Event continues to routinely fire (as it was designed to do).
From the help section:
Description: Modifies an existing Timed Event.
Syntax: ph_modifytimedevent ( id, active, reftime, flags )
Argument Description:
id -String. The ID of the Timed Event you wish to modify.
active - Integer. Use 0 to set the Timed Event inactive. Use 1 to set the Timed Event active. Controlled by the flags parameter.
reftime - DateTime. The new reftime for the specified Timed Event. Controlled by the flags parameter.
flags Integer. Determines which parameters are used to update the Timed Event. Add values together. 1 - Recalculate a new StartTime, 2 - Update the Active parameter, 4 - Set a new RefTime and recalculate StartTime
Return value: Integer. Returns 0 if successful. 1 if the Timed Event specified does not exist.
What am I doing wrong? Should I be using a different reftime or flag?
__________________ Elk - Insteon - BlueIris - DMC1 - PowerHome - XLobby - HA_Bridge w/Dots - Brultech
|
Back to Top |
|
|
grif091 Super User
Joined: March 26 2008 Location: United States
Online Status: Offline Posts: 1357
|
Posted: November 05 2008 at 12:24 | IP Logged
|
|
|
To set a Timed Event inactive (which I am not sure is the same as Disabled) the flags parameter needs a value containing a 2. As the Help section says, Add values together. If you want to Update the Active parameter and Set a new RefTime and recalculate StartTime, flags Integer would be a 6 (2+4). Having said that I used a 2 to see what would happen to one of my Timed Events. It did not result in the Disabled box being checked and the timed event did fire at the defined time. I initially used a flag of 4 which did change the refTime and StartTime. Not sure what active/inactive means. Thought it might set the Boolean value to 0 but I did not see that change either. I think you need a 6 in the flag but I don't know what inactive actually does.
Edited by grif091 - November 05 2008 at 12:26
__________________ Lee G
|
Back to Top |
|
|
dhoward Admin Group
Joined: June 29 2001 Location: United States
Online Status: Offline Posts: 4447
|
Posted: November 05 2008 at 17:42 | IP Logged
|
|
|
Ack, another bug (but this one has a work-around).
The "active" field controls whether a Timed Event is disabled or not (the "Disabled" column). You must add a value of 2 to the flags parameter for PowerHome to modify this field. Normally, a 0 for the "active" column (in the function) with the proper flags parameter will place a check in the "Disabled" column of the timed events. A 1 will uncheck this field. I have found and fixed the bug but you can workaround it now. Instead of using a 0, the function was designed for 0 or less. Instead of a 1, the function will work for 1 or more. It's just the 0 and 1 that isnt working so to disable your Timed Event, use the following function:
ph_modifytimedevent("MESSAGEBOX", - 1,today(),2)
to re-enable it, use:
ph_modifytimedevent("MESSAGEBOX", 2, today(),2)
HTH,
Dave.
|
Back to Top |
|
|
grif091 Super User
Joined: March 26 2008 Location: United States
Online Status: Offline Posts: 1357
|
Posted: November 05 2008 at 19:46 | IP Logged
|
|
|
I was on my way to post a "some good news some bad news message" when I noticed the space between the preceding "," and the minus sign in your post. The Formula Builder would not work with ",-1," but likes ", -1," just fine. Disable box checked and unchecked as described.
Bugs are normal. It is the speed at which you respond to them and offer a work around that makes PowerHome such a great product. Thanks!
__________________ Lee G
|
Back to Top |
|
|
smarty Super User
Joined: May 21 2006 Location: United States
Online Status: Offline Posts: 728
|
Posted: November 05 2008 at 20:15 | IP Logged
|
|
|
Thank you Dave!
Glad you found the bug and glad there is a present work around.
Steve
__________________ Elk - Insteon - BlueIris - DMC1 - PowerHome - XLobby - HA_Bridge w/Dots - Brultech
|
Back to Top |
|
|
|
|