| 
    
     | 
       
        | Author |  |  
        | jpcurcio Senior Member
 
  
  
 Joined: April 01 2007
 Location: United States
 Online Status: Offline
 Posts: 119
 | 
          For some reason I can't get this to work.
           | Posted: November 15 2008 at 13:17 | IP Logged |   |  
           | 
 |  
 I am trying to create a timed event from the trigger of a motion sensor (on or off).  I first tried the ph_createtimedevent(), and it always evaluates to "!".  Here is what I am using:
 
 ph_createtimedevent(2,ph_insteon("DR TABLE LAMP",ioff, 0),datetime( today(), relativetime( now(), 30 )))
 
 I evaluated the ph_insteon and datetime() statements on their own, and they evaluate to proper values.  However, the entire formula evaluation gives me a "!".
 
 Similar behavior with ph_createtimedevent1().
 
 Thanks...
 
 -John
 
 Edited by jpcurcio - November 15 2008 at 13:18
 |  
        | Back to Top |     |  
        |  |  
        | TonyNo Moderator Group
 
  
  
 Joined: December 05 2001
 Location: United States
 Online Status: Offline
 Posts: 2889
 | 
          Try...
           | Posted: November 15 2008 at 13:24 | IP Logged |   |  
           | 
 |  
 ph_createtimedevent(2,ph_insteon("DR TABLE LAMP",ioff, 0), string(datetime( today(), relativetime( now(), 30 ))))
 |  
        | Back to Top |       |  
        |  |  
        | jpcurcio Senior Member
 
  
  
 Joined: April 01 2007
 Location: United States
 Online Status: Offline
 Posts: 119
 | 
          
           | Posted: November 15 2008 at 15:50 | IP Logged |   |  
           | 
 |  
| TonyNo wrote: 
 
    
    | 
      
       | Try... 
 ph_createtimedevent(2,ph_insteon("DR TABLE LAMP",ioff, 0), string(datetime( today(), relativetime( now(), 30 ))))
 |  |  |  
 Still gives a "!" for me...
 
 In the mean time, instead of creating a formula, I created a timed event in this macro, which in turn calls a second macro.  That's a little sloppy, though...
 |  
        | Back to Top |     |  
        |  |  
        | grif091 Super User
 
  
 
 Joined: March 26 2008
 Location: United States
 Online Status: Offline
 Posts: 1357
 | 
          The following works on my system.  The second parameter of the ph_createtimedevent is a string. The problem with this is that you also need to put the device ID in quotes. Use a single quote around the second parameter of the ph_createtimedevent so that the device ID can be double quoted.  The device name is one of my LampLincs because I did not want to alter what I had copy/pasted from a working example.
           | Posted: November 15 2008 at 16:02 | IP Logged |   |  
           | 
 |  
 ph_createtimedevent(2,'ph_insteon("LAMPLINC TEST",ioff,0)',datetime( today(), relativetime( now(), 60 )))
 
 EDIT:  reversing the single/double quotes also works.
 
 ph_createtimedevent(2,"ph_insteon('LAMPLINC TEST',ioff,0)",datetime( today(), relativetime( now(), 60 )))
 
 
 Edited by grif091 - November 15 2008 at 16:09
 
 __________________
 Lee G
 |  
        | Back to Top |     |  
        |  |  
        | jpcurcio Senior Member
 
  
  
 Joined: April 01 2007
 Location: United States
 Online Status: Offline
 Posts: 119
 | 
          
           | Posted: November 15 2008 at 18:21 | IP Logged |   |  
           | 
 |  
| grif091 wrote: 
 
    
    | 
      
       | The following works on my system.  The second parameter of the ph_createtimedevent is a string. The problem with this is that you also need to put the device ID in quotes. Use a single quote around the second parameter of the ph_createtimedevent so that the device ID can be double quoted.  The device name is one of my LampLincs because I did not want to alter what I had copy/pasted from a working example. 
 ph_createtimedevent(2,'ph_insteon("LAMPLINC TEST",ioff,0)',datetime( today(), relativetime( now(), 60 )))
 
 EDIT:  reversing the single/double quotes also works.
 
 ph_createtimedevent(2,"ph_insteon('LAMPLINC TEST',ioff,0)",datetime( today(), relativetime( now(), 60 )))
 
 |  |  |  
 Bingo!!!  Thanks, Lee... got it working now.
 
 -John
 |  
        | Back to Top |     |  
        |  |  |  |