Announcement

Collapse
No announcement yet.

WDC-20 Scripting Question

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    WDC-20 Scripting Question

    I searched for an answer to this first, but couldn't find it, so I was hoping a scripting guru could help me out. I am trying to make an event that increases the Heat Setpoint by 1 degree. I found the Thermostat API, but I think my syntax must be off. I do have the latest Z-wave Tstat plugin (and it is enabled). Take a look at what I have, and see if a glaring error is apparent. Thanks in advance!

    Sub Main

    Dim Mode
    Dim CSP
    Dim HSP
    Dim Fan
    Dim Temp

    Dim pi

    set pi = hs.Plugin("ZWave Thermostats")

    Mode = pi.GetModeSet(1) ' This gets Thermostat 1, indices are available on the config page

    CSP = pi.GetCoolSet(1)
    HSP = pi.GetHeatSet(1)

    Fan = pi.GetFanMode(1)
    Temp = pi.GetTemp(1)

    ' Mode is an enum with these values:
    ' 0 = Off
    ' 1 = Heat
    ' 2 = Cool
    ' 3 = Auto
    ' 4 = Aux/EMHT
    Select case Mode
    case 0
    Mode = "Off"
    Case 1
    Mode = "Heat"
    Case 2
    Mode = "Cool"
    Case 3
    Mode = "Auto"
    Case 4
    Mode = "EMHT"
    end select

    ' Fan is 1 for on, 0 for off/auto
    If Fan = 1 then Fan = "On"
    If Fan = 0 then Fan = "Off/auto"





    pi.CmdSetHeat 1, HSP+1


    End Sub

    #2
    This is an older post, but I found myself wanting to do the same thing. To document this in case someone else needs it, the next to last line seems to be missing parentheses.

    So the following line:

    pi.CmdSetHeat 1, HSP+1

    should read:

    pi.CmdSetHeat(1), HSP+1

    I did not try the existing script before. I altered the script with the above changes and it worked immediately.

    Brian

    Comment


      #3
      May I ask where you found the thermostat API? I did a search of the board, but turned up nothing. I can't find any documentation for the zwave thermostat plugin, specifically as pertains to the WDTC-20. I would appreciate any help finding this info as well.
      Thanks!

      Comment


        #4
        The thermostat API was posred here

        jim

        Comment


          #5
          Thanks...after I posted, I searched again with just "API" and found the link...Any idea how to use the commands to change the "Energysaver" mode of the WDTC-20? Use the "Aux" command? I've seen several threads asking similar question with no response. Has the API been updated to take this setback mode into account?

          Comment


            #6
            I have just about given up on getting documentation for this plugin. The link referenced above is two years old. If you do happen to run across the "energysaver" API, let us know...
            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
              I posted a help desk request asking about being able to change the energysaver mode of the WDTC-20, and was told it would be put on a list of "requested features". OK.. in the mean time, I examined the zstat.thm and the thermostat API and did alittle research and this is the results:

              You can create separate events for each mode and trigger either manually or from other events:
              Heat mode: hs.plugin("ZWave Thermostats").cmdsetmode(1,1,1)
              Cool mode: hs.plugin("ZWave Thermostats").cmdsetmode(1,2,1)
              Energy Saver Heat mode: hs.plugin("ZWave Thermostats").cmdsetmode(1,11,1)
              Energy Saver Cool mode: hs.plugin("ZWave Thermostats").cmdsetmode(1,12,1)

              If you have more than one thermostat registered with the plugin, you will need to change the first number in each command to the thermostat you want to change.
              I have also figured out how to change the setpoint values for each mode through a script or event, if your interested.

              Hope this helps. I was frustrated that the mechanism seemed just under the surface of the plugin, we just needed a little help to bring it to the surface.

              Comment


                #8
                Originally posted by caustin View Post
                I posted a help desk request asking about being able to change the energysaver mode of the WDTC-20, and was told it would be put on a list of "requested features". OK.. in the mean time, I examined the zstat.thm and the thermostat API and did alittle research and this is the results:

                You can create separate events for each mode and trigger either manually or from other events:
                Heat mode: hs.plugin("ZWave Thermostats").cmdsetmode(1,1,1)
                Cool mode: hs.plugin("ZWave Thermostats").cmdsetmode(1,2,1)
                Energy Saver Heat mode: hs.plugin("ZWave Thermostats").cmdsetmode(1,11,1)
                Energy Saver Cool mode: hs.plugin("ZWave Thermostats").cmdsetmode(1,12,1)

                If you have more than one thermostat registered with the plugin, you will need to change the first number in each command to the thermostat you want to change.
                I have also figured out how to change the setpoint values for each mode through a script or event, if your interested.

                Hope this helps. I was frustrated that the mechanism seemed just under the surface of the plugin, we just needed a little help to bring it to the surface.

                Excellent info - thanks!!!
                I would be interested in the setpoint API if you have some code handy.

                Thanks again!
                Rob
                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


                  #9
                  Caustin,

                  <<I have also figured out how to change the setpoint values for each mode through a script or event, if your interested.>>

                  I am also interested in changing the Setpoints of the different modes. Could you post your results? TIA

                  Mark

                  Comment


                    #10
                    Would be happy to do that. I won`t be able to until about the 23rd, though.

                    Comment


                      #11
                      caustin,

                      <<I won`t be able to until about the 23rd, though. >>

                      Thats fine, thanks!

                      I poked around inside the dll and found and tested
                      CmdSetSetPoint(Therm,Value,Mode) so the setpoint writes are now understood. I also see GetCurrentFan(Therm) as well; presumably the current fan operating status.

                      What is still unknown to me is how to read all the EnergySaver setpoints back using vb script. TIA.

                      Mark

                      Comment


                        #12
                        Has anyone yet determined how to read the EnergySave setpoints back either through the plugin or possibly via direct zwave commands?

                        I've got a total of 8 of these thermostats in the house and often use the EnergySave mode on the thermostat itself. But, in order to keep the HSTouch displays up to date, I need to be able to read the EnergySave setpoints.

                        Also, is there any updated list of the API entrypoints (the documentation I found doesn't include the CmdSetSetpoint function mentioned above which seems to work just fine).

                        Thanks,

                        - matt
                        Last edited by mgluniewicz; October 21, 2009, 02:27 PM.

                        Comment


                          #13
                          Matt,

                          I found CmdSetSetPoint by poking around the dll with a hex editor. There are a couple of hints that the EnergySaver stuff was thought about, but it seems there is no application level interface to what appears to be lower level support.

                          I finally have some confidence in the device itself; the mechanical connection between the theremostat and the wiring connector is not very good, it took a while to get to seat properly.

                          Mark

                          Comment


                            #14
                            Yeah, I've been looking at the dll as well, and it doesn't seem that there is a readback function for that setpoint. I suppose pursuing a raw z-wave command is probably the quickest path to a solution.

                            Thanks,

                            - matt

                            Comment


                              #15
                              I found how to access the EnergySave setpoints for readback. The following script writes the Heat Setpoint and EnergySaver Heat Setpoint to the log for each of my thermostats:

                              Code:
                               
                                  Public Sub Main(ByVal Params As Object)
                                      Dim oTStats As Object
                                      Dim oT As Object
                                      Dim i
                                      oTStats = hs.Plugin("ZWave Thermostats")
                                      hs.WriteLog("Test", oTSTats.Name)
                                      for i=1 to oTStats.NThermostats
                               
                                          oT = oTStats.StatObj(i)  ' Get a single Thermostat object
                               
                                          hs.WriteLog("Test", oT.Name)
                                          hs.Writelog("Test", "Current Temp: " & oT.Temperature)
                                          hs.WriteLog("Test", "Heat Setpoint: " & oT.HeatSet)
                                          hs.WriteLog("Test", "EnergySave Heat Setpoint: " & oT.EnergySaverHeatSet)
                                      next
                                      hs.WriteLog("Test", "Test Finished")
                                  End Sub
                              I started using MS Visual Basic 2008 Express Edition along with tenScripting - a very nice combination for developing HS scripts. VB2008 is free from the Microsoft site, and tenScripting is donation-ware (http://www.tenholder.net/tenWare2/tenScripting/).

                              The Object Browser in VB2008 allowed me to find the StatObj() function which returns a single Thermostat object that then contains the EnergySaverHeatSet member.

                              Comment

                              Working...
                              X