| Author |  | 
      
        | Tomcat7194 Newbie
 
  
 
 Joined: November 05 2006
 Online Status: Offline
 Posts: 24
 | 
          Hello, I am new to Powerhome, and I am trying to make a macro that will speak a global variable. I already set up TTS, and I installed the macro GetWeather.
           | Posted: November 05 2006 at 14:45 | IP Logged |   |  
           | 
 |  
 Now, when I run a macro called Speak, I want the computer to say the current temperature, which is stored in the global variable CURTEMP. So far, I have it set up with the code:
 
 ph_tts({CURTEMP})
 
 But this does not do anything. What would be the code to get the computer to speak the global variable CURTEMP when I trigger the macro?
 
 Thanks
 Tom
 
 
 | 
       
        | Back to Top |     | 
       
       
        |  | 
        | smarty Super User
 
  
  
 Joined: May 21 2006
 Location: United States
 Online Status: Offline
 Posts: 729
 | 
          Try this:
           | Posted: November 05 2006 at 15:23 | IP Logged |   |  
           | 
 |  
 ph_tts("{CURTEMP}")
 
 You need to add the quotes
   
 __________________
 Elk - Insteon - BlueIris - DMC1 - PowerHome - XLobby - HA_Bridge w/Dots - Brultech
 | 
       
        | Back to Top |     | 
       
       
        |  | 
        | Tomcat7194 Newbie
 
  
 
 Joined: November 05 2006
 Online Status: Offline
 Posts: 24
 | 
          I tried that, but it just says " C U R T E M P", then "ZERO" rather than saying the value of {CURTEMP}
           | Posted: November 05 2006 at 15:28 | IP Logged |   |  
           | 
 |  
 Any idea how to correct that?
 Tom
 | 
       
        | Back to Top |     | 
       
       
        |  | 
        | Tomcat7194 Newbie
 
  
 
 Joined: November 05 2006
 Online Status: Offline
 Posts: 24
 | 
          Wait, I think I got it. I hadn't actually set up a Global Variable in the category in Setup. Once I added one there, it read the value.
           | Posted: November 05 2006 at 15:30 | IP Logged |   |  
           | 
 |  
 Thanks!
 Tom
 | 
       
        | Back to Top |     | 
       
       
        |  | 
        | dhoward Admin Group
 
  
  
 Joined: June 29 2001
 Location: United States
 Online Status: Offline
 Posts: 4447
 | 
          Tom,
           | Posted: November 06 2006 at 13:03 | IP Logged |   |  
           | 
 |  
 Yep, you got it!  I was just going to post to make sure you have declared the GV.
 
 The way PowerHome works, during formula evaluation, variable substitution is performed first.  PowerHome searches for all occurrences of text between {} and [].  In the case of {}, it looks up in the global variable table for a matching value.  If it's found, then the value of the GV is substituted for the {} and the ID between them.  If the ID isnt found in the GV table, then no substitution is performed.  It works the same for the System variables and the [] tags.
 
 Anyways, glad to see you got it figured out and let me know if you have any other questions or problems.
 
 Dave.
 
 | 
       
        | Back to Top |       | 
       
       
        |  |