Announcement

Collapse
No announcement yet.

Access to ZWave Thermostat Information

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

    Access to ZWave Thermostat Information

    I would like to utilize some of the pieces of information in the ZWave Thermostat "plug-in" to populate some virtual devices. I know I can do this with multiple, complicated events, but wanted to try my hand at scripting to see if I can simplify the process,

    The kinds of information I want to pull out are:
    Mode:Off, Auto, Cool, Heat
    Mode Operationg: Idle, Cooling, Heating
    Current Setpoint
    Current Temperature

    The kinds of things I want to do with the information:
    Graphing Temperature
    Graphing On/Off Cycles
    Creation of a Whole House Fan Logic - I have this largely implemented using multiple events and some Virtual Devices, but would like to increase the sophistication.

    Thanks for any advice.

    Reagrds,
    Vector

    #2
    Is the information your are after in one of the devices? If so just pull that device string and parse out the pieces. Is that the direction you want to go?
    💁‍♂️ Support & Customer Service 🙋‍♂️ Sales Questions 🛒 Shop HomeSeer Products

    Comment


      #3
      Unfortunately, that is about the only way to go without some definitive documentation on the plugin's API. I have some code where I parse the devicestring of the WDTC-20 thermostats to pull the temperature, setpoint and mode. The problem is that if the devicestring ever changes, this code is guaranteed to break - here's a snippet in VB.NET:

      PHP Code:
              Dim sclas As String
              Dim temp 
      As String
              Dim mode 
      As String
              Dim setp 
      As String
              Dim ary
      () As String

              s 
      hs.deviceString(rawDeviceCode)
              
      ary split(s"<")

              
      mode trim(mid(ary(9), instr(ary(9), ":") + 1len(ary(9))))
              
      temp trim(mid(ary(6), instr(ary(6), ":") + 1instr(ary(6), chr(176))))
              
      temp trim(left(tempinstr(tempchr(176)) - 1))
              If (
      InStr(ary(7), Chr(176))) Then
                  setp 
      trim(mid(ary(7), instr(ary(7), ":") + 1instr(ary(7), chr(176))))
                  
      setp trim(left(setpinstr(setpchr(176)) - 1))
              Else
                  
      setp ""
              
      End If 
      I also have some additional code where I am writing the info to SQL Server Express - I was planning on graphing one day, too, but only got as far as capturing the data every :15 mins.

      if/when the API documentation is fully released, I'll be changing this code to pull directly from the plug-in.

      Hope this helps...
      HS4Pro on a Raspberry Pi4
      54 Z-Wave Nodes / 21 Zigbee Devices / 108 Events / 767 Devices
      Plugins: Z-Wave / Zigbee Plus / EasyTrigger / AK Weather / OMNI

      HSTouch Clients: 1 Android

      Comment


        #4
        The thermostat api is available via the HomeSeer SDK under the Thermostat Plug-Ins (Thermostat API) heading.
        💁‍♂️ Support & Customer Service 🙋‍♂️ Sales Questions 🛒 Shop HomeSeer Products

        Comment


          #5
          Wow! Why did they put that in the SDK documentation?? I never would have thought to look there. Thanks for the info! I'll give it a whirl...
          HS4Pro on a Raspberry Pi4
          54 Z-Wave Nodes / 21 Zigbee Devices / 108 Events / 767 Devices
          Plugins: Z-Wave / Zigbee Plus / EasyTrigger / AK Weather / OMNI

          HSTouch Clients: 1 Android

          Comment


            #6
            Thanks again, Rupp! I never would have thought to look in the SDK...

            Here's how to pull the above vars straight from the plugin itself:

            PHP Code:
            Sub UpdateStatusV2(ByVal parm As String)
                    
            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)=0Then
                            mode
            ="Off"
                        
            ElseIf (pi.GetCurrentMode(2)=1Then
                            mode
            ="Heat"
                        
            ElseIf(pi.GetCurrentMode(2)=2Then
                            mode
            ="Cool"
                        
            ElseIf(pi.GetCurrentMode(2)=3Then
                            mode
            ="Auto"
                        
            ElseIf(pi.GetCurrentMode(2)=4Then
                            mode
            ="Aux"
                        
            End If
                                  
                        
            hs.writeLog("debug","temp=[" temp "]  setp=[" setp "]  mode=[" mode "]")
                                    
                    Catch 
            As Exception
                        hs
            .WriteLog("debug"e.Message)
                    Finally
                        
            pi Nothing
                    End 
            Try

            End Sub 
            HS4Pro on a Raspberry Pi4
            54 Z-Wave Nodes / 21 Zigbee Devices / 108 Events / 767 Devices
            Plugins: Z-Wave / Zigbee Plus / EasyTrigger / AK Weather / OMNI

            HSTouch Clients: 1 Android

            Comment


              #7
              Thanks to both of you for this information. I will experiment around with it.

              Regards,
              Vector

              Comment


                #8
                Where did you find this example? I d/l the SDK and there are no code examples.

                Originally posted by rmasonjr View Post
                Thanks again, Rupp! I never would have thought to look in the SDK...

                Here's how to pull the above vars straight from the plugin itself:

                PHP Code:
                Sub UpdateStatusV2(ByVal parm As String)
                        
                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)=0Then
                                mode
                ="Off"
                            
                ElseIf (pi.GetCurrentMode(2)=1Then
                                mode
                ="Heat"
                            
                ElseIf(pi.GetCurrentMode(2)=2Then
                                mode
                ="Cool"
                            
                ElseIf(pi.GetCurrentMode(2)=3Then
                                mode
                ="Auto"
                            
                ElseIf(pi.GetCurrentMode(2)=4Then
                                mode
                ="Aux"
                            
                End If
                 
                            
                hs.writeLog("debug","temp=[" temp "]  setp=[" setp "]  mode=[" mode "]")
                 
                        Catch 
                As Exception
                            hs
                .WriteLog("debug"e.Message)
                        Finally
                            
                pi Nothing
                        End 
                Try
                 
                End Sub 
                Don

                Comment


                  #9
                  I wrote that Once I found the thermostat SDK, I used the plugin API to get the values.
                  HS4Pro on a Raspberry Pi4
                  54 Z-Wave Nodes / 21 Zigbee Devices / 108 Events / 767 Devices
                  Plugins: Z-Wave / Zigbee Plus / EasyTrigger / AK Weather / OMNI

                  HSTouch Clients: 1 Android

                  Comment


                    #10
                    Gotcha. Thanks. I am struggling with the TRY, CATCH and END TRY stuff. I guess this is VB Net syntax.
                    Don

                    Comment


                      #11
                      Originally posted by donstephens View Post
                      Gotcha. Thanks. I am struggling with the TRY, CATCH and END TRY stuff. I guess this is VB Net syntax.
                      Yes that is .net syntax for error trapping.
                      💁‍♂️ Support & Customer Service 🙋‍♂️ Sales Questions 🛒 Shop HomeSeer Products

                      Comment


                        #12
                        The code in the Try section will be executed and trapped for exceptions (errors). If an exception is thrown anywhere in that code block, the code in the Catch section will be executed, with the Exception object available to you (so for instance you can use e.ToString() to see the error result). The Finally block is executed after all the other code has been executed.
                        HS Pro 3.0 | Linux Ubuntu 16.04 x64 virtualized under Proxmox (KVM)
                        Hardware: Z-NET - W800 Serial - Digi PortServer TS/8 and TS/16 serial to Ethernet - Insteon PLM - RFXCOM - X10 Wireless
                        Plugins: HSTouch iOS and Android, RFXCOM, BlueIris, BLLock, BLDSC, BLRF, Insteon PLM (MNSandler), Device History, Ecobee, BLRing, Kodi, UltraWeatherWU3
                        Second home: Zee S2 with Z-Wave, CT101 Z-Wave Thermostat, Aeotec Z-Wave microswitches, HSM200 occupancy sensor, Ecolink Z-Wave door sensors, STI Driveway Monitor interfaced to Zee S2 GPIO pins.

                        Comment

                        Working...
                        X