Announcement

Collapse
No announcement yet.

ControlThermostat - THM Script Help

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    ControlThermostat - THM Script Help

    I'm new to HomeSeer and scripting - so excuse me if my problem is obvious.

    I'm running HSPro rev: 2.4.0.6

    I've installed a Trane Zwave thermostat and am trying to figure out how to write a script to control it (and learn how to write scripts) based on various conditions.

    The following script only writes Time and "Status" in the log, the rest is blank and the thermostat setpoint does not change:

    Sub Main
    ' get the current temperature
    dim temp
    temp = hs.ControlThermostat("Q24","GetTemp",0)
    hs.WriteLog "Status", temp
    ' set the set point to 55 degrees
    hs.ControlThermostat "Q24","SetSetPoint",55
    End Sub

    In the status screen, the Thermostat is listed as Q24 and the child Temp value is Q25. I tried changing the first Q24 to Q25 and that didn't work either.

    Any help would be appreciated.

    Alan

    #2
    See this post for the correct use of the thermostat api.

    http://board.homeseer.com/showpost.p...21&postcount=6
    💁‍♂️ Support & Customer Service 🙋‍♂️ Sales Questions 🛒 Shop HomeSeer Products

    Comment


      #3
      This doesn't work? Saved as stat.vb in your scripts directory? What version of HS are you running?

      Code:
      Sub Main(parm as object) 
      Dim pi As Object 
      Dim setp,mode,temp As String 
      
      Try 
      pi = hs.Plugin("ZWave Thermostats") 
      temp = pi.GetTemp(2) 
      setp = pi.GetHeatSet(2) 
      If(pi.GetCurrentMode(2)=0) Then 
      mode="Off" 
      ElseIf (pi.GetCurrentMode(2)=1) Then 
      mode="Heat" 
      ElseIf(pi.GetCurrentMode(2)=2) Then 
      mode="Cool" 
      ElseIf(pi.GetCurrentMode(2)=3) Then 
      mode="Auto" 
      ElseIf(pi.GetCurrentMode(2)=4) Then 
      mode="Aux" 
      End If 
      
      hs.writeLog("debug","temp=[" & temp & "] setp=[" & setp & "] mode=[" & mode & "]") 
      
      Catch e As Exception 
      hs.WriteLog("debug", e.Message) 
      Finally 
      pi = Nothing 
      End Try 
      
      End Sub
      💁‍♂️ Support & Customer Service 🙋‍♂️ Sales Questions 🛒 Shop HomeSeer Products

      Comment


        #4
        Try this

        Code:
        Sub Main(parm as object) 
        Dim pi As Object 
        Dim temp as Double
        
        pi = hs.Plugin("ZWave Thermostats") 
        temp = pi.GetTemp(1) 
        
        hs.writelog("test", temp)
        End Sub
        Last edited by Rupp; February 8, 2010, 05:40 PM.
        💁‍♂️ Support & Customer Service 🙋‍♂️ Sales Questions 🛒 Shop HomeSeer Products

        Comment


          #5
          I added:
          Dim temp As Integer...

          2/8/2010 2:39:14 PM test 67
          2/8/2010 2:39:14 PM Event Running script in background: Thermotest6.vb

          Comment


            #6
            So now you are on your way. Download the HomeSeer SDK from the updater and have a look at the calls that can be made using the Thermostat API. I'll edit a few of these posts out to clear up and confusion.
            💁‍♂️ Support & Customer Service 🙋‍♂️ Sales Questions 🛒 Shop HomeSeer Products

            Comment


              #7
              Thanks. I seem closer, yes.

              I tried ... CmdSetHeat(1,50)

              and I got a return from ... GetHeatSet(1) that is set to 50. However, if I look at the Trane thermostat, it is still set at 55.

              Any other great words of advise?

              Thanks,

              Alan

              Comment


                #8
                Try
                Code:
                Sub Main(parm as object) 
                Dim pi As Object 
                Dim ret as integer
                
                pi = hs.Plugin("ZWave Thermostats") 
                ret= pi.CmdSetHeat(1,50) 
                
                hs.writelog("test", ret)
                End Sub
                💁‍♂️ Support & Customer Service 🙋‍♂️ Sales Questions 🛒 Shop HomeSeer Products

                Comment


                  #9
                  Rupp,

                  That worked. However, I discovered also that it would not work unless my temp setting was greater than 55 deg. I appears to be a setting within the Trane thermostat.

                  Thanks for your help!

                  Comment

                  Working...
                  X