Author |
|
BeachBum Super User
Joined: April 11 2007 Location: United States
Online Status: Offline Posts: 1880
|
Posted: October 26 2010 at 10:02 | IP Logged
|
|
|
When you create a macro and use the pulldown for selection as in Create Timed Event the SQL Direct works. When I use a formula PH_CTREATETIMEDEVENT1 the SQL returns 0 but fails to delete the event. Although Dave may know of a way to get to it.
__________________ Pete - X10 Oldie
|
Back to Top |
|
|
GadgetGuy Super User
Joined: June 01 2008 Location: United States
Online Status: Offline Posts: 942
|
Posted: October 26 2010 at 10:49 | IP Logged
|
|
|
BeachBum wrote:
When you create a macro and use the pulldown for selection as in Create Timed Event the SQL Direct works. |
|
|
No problem. I can do it that way instead of the ph_createtimedevent1 function.
But I'm not sure of the process. When you select Create Timed Event with the pull-down menu it only shows defined Macros in the ID field pull down list. So I created a new macro called GD LIGHT OFF and put a single entry in it using the ph_createtimedevent1() function.
But what goes into the Send Keys/TTS/Dim/Formula field of the Macro Detail in the motion macro where I inserted the Create Timed Event pull-down action?
Edited by GadgetGuy - October 26 2010 at 10:57
__________________ Ken B - Live every day like it's your last. Eventually, you'll get it right!
|
Back to Top |
|
|
BeachBum Super User
Joined: April 11 2007 Location: United States
Online Status: Offline Posts: 1880
|
Posted: October 26 2010 at 14:00 | IP Logged
|
|
|
OK, you have created a macro that has under Command you select “Create Timed Event”. You then select a macro to run as a result. In the Send Keys area you specify the minutes from now you want his event to fire. It would be similar to using the old ph_createtimedevent ( type, action, datetime ) formula.
__________________ Pete - X10 Oldie
|
Back to Top |
|
|
GadgetGuy Super User
Joined: June 01 2008 Location: United States
Online Status: Offline Posts: 942
|
Posted: October 26 2010 at 14:04 | IP Logged
|
|
|
OK. Found I didn't search far enough in the PH Documentation. Stopped looking at "Timed Event" Finds before the last one!
Now I know that the Formula field must contain a time/date value or the number of minutes from Now(), so I stuck a "5" in there and indeed it does create a new Timed Event 5 mintues later, as desired, BUT the reason I started down this new path was to be able to delete timed events and this new methodology does not create a named event but a generic one of the form "__OS-0".
With this hiccup in the soup, I can no longer use the
Code:
PH_DIRECTSQL("DELETE FROM TIMEDEVENTS WHERE FREQUENCY = 0 AND ACTION = 'GD-LITE OFF'") |
|
|
method that I was using to delete.
I'm chasing my tail, and not gaining here.
Any ideas?
David! HELP!
__________________ Ken B - Live every day like it's your last. Eventually, you'll get it right!
|
Back to Top |
|
|
grif091 Super User
Joined: March 26 2008 Location: United States
Online Status: Offline Posts: 1357
|
Posted: October 26 2010 at 14:11 | IP Logged
|
|
|
The ph_createtimedevent1() variant allows a user specified ID.
__________________ Lee G
|
Back to Top |
|
|
BeachBum Super User
Joined: April 11 2007 Location: United States
Online Status: Offline Posts: 1880
|
Posted: October 26 2010 at 14:16 | IP Logged
|
|
|
Lee, the problem I have had is the delete SQL does not delete possibly because the Action does not match.
__________________ Pete - X10 Oldie
|
Back to Top |
|
|
GadgetGuy Super User
Joined: June 01 2008 Location: United States
Online Status: Offline Posts: 942
|
Posted: October 26 2010 at 14:17 | IP Logged
|
|
|
Well - I just changed the SQL Delete Action from "GD-LITE OFF" to "_OS-0" in order to eliminate the event which was created by default by the system. As long as I don't generate any other generic events, this should work, but it is a bit "messy" and would rather have a named ID to work with, if possible.
__________________ Ken B - Live every day like it's your last. Eventually, you'll get it right!
|
Back to Top |
|
|
GadgetGuy Super User
Joined: June 01 2008 Location: United States
Online Status: Offline Posts: 942
|
Posted: October 26 2010 at 14:21 | IP Logged
|
|
|
BeachBum wrote:
Lee, the problem I have had is the delete SQL does not delete possibly because the Action does not match. |
|
|
Roger that! Pete I was using the event1 style function, but then cannot delete it's events to keep them from piling up when I add another.
Switching to the ADD TIMED EVENT pulldown menu item, allows deletes but then creates a new set of issues (see above). I've just caved in for the moment and am just deleting the "_OS-0" generic event, which seems to work OK.
Edited by GadgetGuy - October 26 2010 at 14:36
__________________ Ken B - Live every day like it's your last. Eventually, you'll get it right!
|
Back to Top |
|
|
BeachBum Super User
Joined: April 11 2007 Location: United States
Online Status: Offline Posts: 1880
|
Posted: October 26 2010 at 14:21 | IP Logged
|
|
|
It does allow you to generate a unique username ie: ph_createtimedevent1("WATER_HEATER_OFF",1,0,0,1,15,DATETIME( TODAY(),NOW()),0,"H2O_HTR_OFF","1") but I can’t seem to delete it using that name.
__________________ Pete - X10 Oldie
|
Back to Top |
|
|
GadgetGuy Super User
Joined: June 01 2008 Location: United States
Online Status: Offline Posts: 942
|
Posted: October 26 2010 at 14:35 | IP Logged
|
|
|
BeachBum wrote:
. . . but I can’t seem to delete it using that name. |
|
|
Yep! You nailed it! That has been my problem and why I had to go to the pull-down menu approach to creating a Timed Event. After a few minutes of testing the method of deleting the generic "_OS-0" event seems to be working OK, but it just doesn't feel very "clean."
__________________ Ken B - Live every day like it's your last. Eventually, you'll get it right!
|
Back to Top |
|
|
BeachBum Super User
Joined: April 11 2007 Location: United States
Online Status: Offline Posts: 1880
|
Posted: October 26 2010 at 14:46 | IP Logged
|
|
|
I’m sure Dave knows the way. I’ve tried various fields but can’t seem to key in on the unique name.
__________________ Pete - X10 Oldie
|
Back to Top |
|
|
dhoward Admin Group
Joined: June 29 2001 Location: United States
Online Status: Offline Posts: 4447
|
Posted: October 27 2010 at 11:26 | IP Logged
|
|
|
I just checked the documentation and see that I never provided an easy method to delete a timed event. Don't know how I missed that but Ive added an additional flag to the ph_modifytimedevent function so that you can delete a specific event ID.
The best way to handle this currently is to use the ph_createtimedevent1 function and create a "named" timed event with a specific ID. Once you have a known ID, then just use the following direct SQL function to delete it:
ph_directsql("delete from timedevents where id = 'YOUR EVENT ID'")
I just tested this and it worked without issue. One other clarification as well, the Timed Events screen in the PowerHome Explorer (actually all of the screens in the Explorer) are not auto updated and you wont see the results of the ph_directsql function until you hit the F5 key and refresh (assuming the Explorer was already open and sitting on the Timed Events screen).
Hope this helps,
Dave.
|
Back to Top |
|
|
GadgetGuy Super User
Joined: June 01 2008 Location: United States
Online Status: Offline Posts: 942
|
Posted: October 27 2010 at 19:50 | IP Logged
|
|
|
Ah David, my friend. As always you are AWESOME!
Thanks for the feedback.
PS - Just tried it and it WORKS PERFECTLY!!!!!!!!
Yah!
Edited by GadgetGuy - October 27 2010 at 19:57
__________________ Ken B - Live every day like it's your last. Eventually, you'll get it right!
|
Back to Top |
|
|
BeachBum Super User
Joined: April 11 2007 Location: United States
Online Status: Offline Posts: 1880
|
Posted: October 27 2010 at 21:35 | IP Logged
|
|
|
Ya just got to be a believer… I told you he would have a way…
__________________ Pete - X10 Oldie
|
Back to Top |
|
|
GadgetGuy Super User
Joined: June 01 2008 Location: United States
Online Status: Offline Posts: 942
|
Posted: October 28 2010 at 07:40 | IP Logged
|
|
|
BeachBum wrote:
Ya just got to be a believer… I told you he would have a way… |
|
|
I NEVER doubted for a moment. I'm not only a believer, but a preacher too. Why for years now I've been touting Dave and PH to anyone that I think I might be interested!
I haven't sold the thousands of PH's that I think is appropriate (if the truth be known, maybe 3-4 is a valid number) but that hasn't stopped my enthusiasm.
In fact, once the next release comes out with all the magnificent improvements and features I suspect it will have, I'm planning to be a big rabble rouser here in the Forum to inundate SmartHome with inquiries and comments about PH and try to get it moved to the front pages of the catalog, instead of buried in the only-god-knows-where (I've never found it except by a direct name search) bowels of their order system.
I was a beta tester years ago for the SmartHome automation software, but found it to be hopelessly inadequate, and it hasn't changed much since IMHO, except to get glitzier.
PH deserves to be the lead ship!
That's my story and I'm stickin' to it!
__________________ Ken B - Live every day like it's your last. Eventually, you'll get it right!
|
Back to Top |
|
|
GadgetGuy Super User
Joined: June 01 2008 Location: United States
Online Status: Offline Posts: 942
|
Posted: May 21 2011 at 15:17 | IP Logged
|
|
|
dhoward wrote:
I just checked the documentation and see that I never provided an easy method to delete a timed event. Don't know how I missed that but Ive added an additional flag to the ph_modifytimedevent function so that you can delete a specific event ID.
The best way to handle this currently is to use the ph_createtimedevent1 function and create a "named" timed event with a specific ID. Once you have a known ID, then just use the following direct SQL function to delete it:
ph_directsql("delete from timedevents where id = 'YOUR EVENT ID'")
I just tested this and it worked without issue. One other clarification as well, the Timed Events screen in the PowerHome Explorer (actually all of the screens in the Explorer) are not auto updated and you wont see the results of the ph_directsql function until you hit the F5 key and refresh (assuming the Explorer was already open and sitting on the Timed Events screen).
Hope this helps,
Dave.
|
|
|
Well?
Dave -is this included in the 2.1.4 releases, and if so what is the Flag?
__________________ Ken B - Live every day like it's your last. Eventually, you'll get it right!
|
Back to Top |
|
|
BeachBum Super User
Joined: April 11 2007 Location: United States
Online Status: Offline Posts: 1880
|
Posted: May 22 2011 at 07:25 | IP Logged
|
|
|
Ken, I use the “active” flag to delete the event. Seems to work like delete.
__________________ Pete - X10 Oldie
|
Back to Top |
|
|
dhoward Admin Group
Joined: June 29 2001 Location: United States
Online Status: Offline Posts: 4447
|
Posted: May 22 2011 at 15:46 | IP Logged
|
|
|
Ken,
Yes it is
ph_deletetimedevent(string as_id)
Hope this helps,
Dave.
|
Back to Top |
|
|
GadgetGuy Super User
Joined: June 01 2008 Location: United States
Online Status: Offline Posts: 942
|
Posted: May 22 2011 at 16:31 | IP Logged
|
|
|
dhoward wrote:
Ken,
Yes it is
ph_deletetimedevent(string as_id)
Hope this helps,
Dave.
|
|
|
Yep! Yep!
Not only helps, but it works too!
That's a little cleaner than the SQL delete. Thanks Dave.
__________________ Ken B - Live every day like it's your last. Eventually, you'll get it right!
|
Back to Top |
|
|
BeachBum Super User
Joined: April 11 2007 Location: United States
Online Status: Offline Posts: 1880
|
Posted: May 22 2011 at 16:56 | IP Logged
|
|
|
OK Ken soap box time… One of us or most of us need to start documenting these tidbits so we stop asking the same questions. Now that Dave came back I swear I heard it somewhere before. I don’t have the answer yet how we do this but it sure is needed and Dave shouldn’t be the one held responsible. Maybe a category of helpful hints and examples would help. Lee alone could write a book on Insteon. I for one know nothing about presenting PH on a touch screen but I bet Tony has a lot of useful info on it. Just my 2 cents…
__________________ Pete - X10 Oldie
|
Back to Top |
|
|