| 
    
     | 
       
        | Author |  |  
        | krommetje Super User
 
  
  
 Joined: December 29 2004
 Location: Netherlands
 Online Status: Offline
 Posts: 695
 | 
          Hi all,
           | Posted: November 23 2005 at 09:00 | IP Logged |   |  
           | 
 |  
 I am extending my firealarm with a memoryfunction: when an alarm is given, PH stores the last state of my Front and rear doorshutter in a GV ....
 
 here is the code I came up with:
 
 
 
| Code: 
 
    
    | 
      
       | ph_setglobal_a("K4STATE",[X10STATK4]) |  |  |  
 when the shutter is down, the state is off, in which I have to change the GV to 3 and here is the code for that:
 
 
 
| Code: 
 
    
    | 
      
       | case( [X10STATK4]  when 1 then ph_setglobal_a("K4STATE",3)) 
 |  |  |  
 When the shutter is up then the state is on and the GV remains 2
 
 so after an all-safe is given I want to send an X10 command to the shutter and return to it's last state before the firealarm and here is that code too:
 
 
 
| Code: 
 
    
    | 
      
       | ph_x10btn ("K",4,ph_getglobal_n("{K4STATE}"),0)
 
 |  |  |  
 but here is the fault: no matter what value is stored in the GV, always a ALL UNITS OFF  command is sent...
 
 what am I not seeing here?
 
 Peter
 |  
        | Back to Top |       |  
        |  |  
        | dhoward Admin Group
 
  
  
 Joined: June 29 2001
 Location: United States
 Online Status: Offline
 Posts: 4447
 | 
          Peter,
           | Posted: November 23 2005 at 15:52 | IP Logged |   |  
           | 
 |  
 You mixed a variable substitution form of a global variable (enclosed within {}) with the ph_getglobal_n function.  So, you would either:
 
 ph_x10btn("K",4,{K4STATE},0)
 
 or,
 
 ph_x10btn("K",4,ph_getglobal_n("K4STATE"),0)
 
 Hope this helps,
 
 Dave.
 
 |  
        | Back to Top |       |  
        |  |  
        | krommetje Super User
 
  
  
 Joined: December 29 2004
 Location: Netherlands
 Online Status: Offline
 Posts: 695
 | 
          OH MAN.....
           | Posted: November 24 2005 at 03:53 | IP Logged |   |  
           | 
 |    
 I aint never gonna get this GV stuff into my thick head....
 
 Am I lost forever????
 
 btw. works like a charm now!!!
   
 Peter
 
 
 
 btw: have you seen my post(s) in General in thread uptime?
 
 Edited by krommetje
 |  
        | Back to Top |       |  
        |  |  |  |