No announcement yet.

After Upgrading to HS4, my HVAC setpoints no longer respond to CAPI commands

  • Filter
  • Time
  • Show
Clear All
new posts

    After Upgrading to HS4, my HVAC setpoints no longer respond to CAPI commands

    This is my vbscript for incrementing the cooling set point for one of my A/C units. This code seemed to quit working after the HS4 upgrade. It worked perfectly for 2+ years prior to that. Forgive the logging and the verbose extra code. I have been trying to debug this for a while now. (Also, I am a c,c++, c# guy, so the vbscript is not really my cup of tea, so it is not optimized).

    Here is the code:

    Public Sub Main(ByVal param As String)

    hs.WriteLog("Starting ","incMainCoolSetPoint")

    Dim CoolSetPoint as Integer
    Dim newCoolSetPoint as Integer
    Dim deviceID as Integer
    Dim statusDeviceID as Integer

    deviceID = 324
    statusDeviceID = 667

    CoolSetPoint = hs.DeviceValue(deviceID)

    hs.WriteLog("Current Cool setpoint ", CoolSetPoint)

    newCoolSetPoint = CoolSetPoint +1

    Dim results = SetDeviceByControlValue(deviceID, newCoolSetPoint)
    Dim statusString as String

    newCoolSetPoint = hs.DeviceValue(deviceID)
    If newCoolSetPoint = CoolSetPoint Then
    statusString = "Cool SetPoint did not change"
    statusString = "New Cool SetPoint: " & newCoolSetPoint
    End If

    hs.SetDeviceString(statusDeviceID, statusString, True)

    hs.WriteLog("CAPI results ", results)

    End Sub

    Function SetDeviceByControlValue(ByVal intDevRef As Integer, ByVal ctlValue As Integer) As CAPIControlResponse
    ' Sets this device (refID) by Control Value [CAPI: ControlValue] - e.g. 0 = off, 1 = Cool, 2 = Cool...
    SetDeviceByControlValue = CAPIControlResponse.Indeterminate
    For Each objCAPIControl As CAPIControl In hs.CAPIGetControl(intDevRef)
    'hs.WriteLog("Control Value: ", LCase(objCAPIControl.ControlValue))
    If LCase(objCAPIControl.ControlValue) = ctlValue Then
    SetDeviceByControlValue = hs.CAPIControlHandler(objCAPIControl)
    Exit For
    End If
    End Function

    From my log file:
    8/19/2020 5:32:33 PM

    CAPI results

    8/19/2020 5:32:33 PM

    Cool SetPoint did not change

    8/19/2020 5:32:33 PM

    Current Cool setpoint

    8/19/2020 5:32:33 PM


    Did you update the DeviceID's?


      In this particular script, the Main Unit Cooling SetPoint Device id is is what I have in my code. The status Device ID is for a Virtual Device. I have the same script running on two other systems without issue, and as I mentioned earlier, it worked for me for 2+ years.

      Unless someone sees some VBScript issue with my code or has another suggestion, I was considering excluding my Main thermostat from my Z-Wave controller and re-adding, but then I have to update a bunch of scripts and quite a bit of HSTouch code. Thanks


        Before you remove and re add your thermostat, I would suggest you install Tenscripting, import your script, and use it to help you troubleshoot. He has a set of video's to help you walk through the installation and initial use as well as written documentation. He also has other related scripting aids you may find useful.

        HS4 Pro on Shuttle NC10U, Win10; Z-NET
        Number of Devices: 449
        Number of Events: 210

        Plug-Ins: Arduino, BLLock, DirecTv, EasyTrigger, Honeywell WiFi Thermostat, MeiHarmonyHub, PHLocation2, Pushover 3P, UltraM1G3, WeatherXML, Worx Landroid, Z-Wave

        External applications: Homebridge-homeseer, Geofency, EgiGeoZone.


          If you can control the thermostat from the web interface, excluding and adding is unlikely to make a difference to the problem.

          Sent from my Pixel 2 using Tapatalk


            It's not a solution to your script but you could also consider EasyTrigger. I know it's more money so I understand you might want to stick with your code but it is useful for quite a lot of stuff that otherwise would require scripting. But of course if you enjoy scripting then that's a bad argument...


              I don't think it is in my vbscript as the same code runs in 4 places on two other systems without issue, and worked perfectly on mine as well until HS4. I can call HS about it, but they will tell me that they do not get involved with scripting, etc....

              A variant of this code works perfectly to change the system mode and fan mode. Another can turn the system on/off and another does the same for the fan.

              The only items that don't seem to work now are the setpoints. HS4 seems to handle these differently, as features of the thermostat, rather than separate devices. I don't have all of the same granular control in the web interface like polling interval, etc. for the features...that all seems to be at the parent level now.

              The web interface still works as does Alexa, and I assume Google Assistant, although I have not confirmed that yet.


                This line could cause an issue:
                If LCase(objCAPIControl.ControlValue) = ctlValue Then
                You need to remove the LCase as that is converting the Control Value (which is a double) to a string and you are then trying to match against an integer. As it is numeric, lowering the case does nothing.


                  Keep looking in your CAPI sub. It looks wonky.. It's returning a 0 result, should be 1.

                  In particular, where you're setting your new control value:
                  If LCase(objCAPIControl.ControlValue) = ctlValue Then

                  Make sure it's true. Better yet just try setting it directly instead of a conditional. Not sure why you LCase a double value? Might also try passing it as a double as well in the arguments.



                    You can test CAPI controls, and generating scripting code for CAPI calls using tenScriptAid.


                      Good catch on the LCase was leftover from old code, but strangely enough, it seemed to have no effect on the script. I did remove it, but that made no difference.

                      So, I have a spare mounting panel for my thermostats and a 24VAC PSU and I removed my Honeywell Z-Wave thermostats and used my spare bracket to place them close enough to the HS4 computer and excluded them from the Z-Wave network. I then re-included them. (Obviously, I did this one-at-a-time to see if it worked)

                      Once I did that, I modified my code and the scripts to use the new Device names and IDs, and everything worked perfectly. It still makes no sense to me why I had to do this, but it certainly fixed my problem.

                      Tyler, or anyone else from Homeseer Support...if you read these, maybe you could send this over to the Devs. I would be happy to provide additional information if anyone from HS wants to chase this down.