Announcement

Collapse
No announcement yet.

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

Collapse
X
 
  • 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"
    Else
    statusString = "New Cool SetPoint: " & newCoolSetPoint
    End If

    hs.SetDeviceString(statusDeviceID, statusString, True)

    hs.WriteLog("Status",statusString)
    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
    Next
    End Function


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

    Script
    CAPI results
    0

    8/19/2020 5:32:33 PM

    Script
    Status
    Cool SetPoint did not change

    8/19/2020 5:32:33 PM

    Script
    Current Cool setpoint
    72

    8/19/2020 5:32:33 PM

    Script
    Starting
    incMainCoolSetPoint


    #2
    Did you update the DeviceID's?

    Comment


      #3
      In this particular script, the Main Unit Cooling SetPoint Device id is 324...it 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

      Comment


        #4
        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.

        http://tenholder.net/tenWare2/tenScripting/default.aspx

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

        Plug-Ins: BLLock, DirecTv, EasyTrigger, Honeywell WiFi Thermostat, Marquis monoprice Amp, MeiHarmonyHub, PHLocation2, Pushover 3P, UltraM1G3, rnbWeather, Worx Landroid, Z-Wave

        External applications: Homebridge-homeseer, Geofency, EgiGeoZone.

        Comment


          #5
          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

          Comment


            #6
            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...

            Comment


              #7
              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.

              Comment


                #8
                This line could cause an issue:
                Code:
                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.
                Jon

                Comment


                  #9
                  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.

                  Z

                  Comment


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

                    Comment


                      #11
                      Good catch on the LCase operation..it 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.

                      Comment

                      Working...
                      X