Announcement

Collapse
No announcement yet.

change setpoint by script

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

    change setpoint by script

    Hi -
    I'm sure I've seen the answer to this question but I've looked high and low and can't find it.

    I used mcsTemperature to setup up a setpoint and a temperature control loop to maintain a hot tub temperature. mcsTemperature set up device R38 as the setpoint and everything is working great.

    Now I'm trying to change R38 by using a script. If I use

    hs.SetDeviceValue "R38",hs.DeviceValue("R38")+2

    it successfully changes the value in the popup menu of the setpoint but it isn't actually changing the value that the control loop is using (or the value shown in the Status field with the icon.

    Any help would be appreciated.

    Thanks.

    Pat

    #2
    My first guess is that device code R is not associated with mcsTemperature so HS never informs mcsTemperature that it changed the value. You can determine this by looking at the .Interface property of the setpoint device R38. I think the following 1-line script could be placed in a manual event to display it. I also have a utility posted several places that will show this information. I think it is called InterfaceManager or ManageInterface.

    &msgbox(hs.GetDevice(hs.DeviceExists("R38")).Interface)

    If you determine this to be the case then you should be able to make the association by the following and see if that resolved the problem.

    &hs.GetDevice(hs.DeviceExists("R38")).Interface="mcsTemperat ure"

    Comment


      #3
      Thanks for the reply Michael. mcsTemperature actually created the R38 device but I ran the script anyway. The msgbox said "mcsTemperature" in it.

      Pat

      Comment


        #4
        The debug setting will produce an output with a line starting "setO" when HS calls mcsTemperature to inform of a device change. Confirm that you are getting this call and then show me what the debug output line is for it.

        Comment


          #5
          Michael -
          I turned on debug and besides a flood of my 1-wire log entries all I saw that had anything to do with R38 was this one line:

          12/7/2008 12:54:12 PM - mcsTemperature - Check Device Event R38=17,DictionaryExists=False

          I've attached a screenshot so that you can see that the script is changing the value in the pop-up menu on the right side but not the actual value of R38.

          Thanks for the help.

          Pat
          Attached Files

          Comment


            #6
            We have two ways to go. One is to understand why the SETIO is not being executed or to add a callback for DeviceValue changes. I only have a few hours before I need to leave for the airport so I will need your help if we are to get this done soon.

            The one line that you posted from your debug occurred because it appeared as if the DeviceStatus of R38 changed. What we are looking for is the SETIO.

            The first is to see what mcsTemperature believes your house codes are. This is visible on the Windows Setup form in the lower left. There will be 2 shown. The third option, which I believe should be your case is from the mcsTemperature.ini file and is at key "TemperatureHouse". I expect it to be TemperatureHouse="R". If is is not one of these three then mcsTemperature assumes the SETIO call has no action for it.

            I will try to setup a test environment to add the Value change callback, but my preferred approach is the original design since you really do not want mcsTemperature to be called every time any device value changes within HS.

            Comment


              #7
              Thanks Michael. I'm also on short-time frame today, and there isn't a huge urgency for this, so let me have a look at this and get back to you later. No need to rush. Have a safe trip.

              Thanks again.

              Cheers,

              Pat

              Comment


                #8
                I did a little test on my system. I created a thermosat device at `37. From the HS Device/Status page I selected the second temperature reading. This showed up in the HS log as a SetIO. I then ran a script to set DeviceValue of `37 to 4. This also showed up in the HS log. Third I confirmed the interface property of `37.

                Code:
                12/7/2008 2:02:11 PM ~!~mcsTemperature Debug~!~setIO `37 from 17 to 19, brightness=2
                12/7/2008 2:03:45 PM ~!~mcsTemperature Debug~!~setIO `37 from 17 to 19, brightness=4
                12/7/2008 2:05:48 PM ~!~Interface~!~mcsTemperature
                My guess is that HS sees the "R" and considers it one of its own house code. "R" will never be assigned to a plugin by HS when a plugin asks for a House code. To confirm this I believe a help desk ticket will be needed.

                On the setup form there is a button to create plugin house codes. This should not affect your curent setup, but I'm not certain so you should create a backup before you go down this path. This will actually create two special character house codes and use of them will not confuse HS. To use it as a thermostat device you likely will need to change the default house code for new devices on the Device/Files page if it was not automatically changed for you and then recreate another thermostat device. This may not be convenient depending upon the dependencies you have setup.

                If HST does respond then there may be a way to have the "R" house code reported to mcsTemperature if mcsTemperature is in the .Interface property. This would be preferred to minimize potential impact on your current setup.

                Comment


                  #9
                  Hi Michael -
                  I think we're getting somewhere. I've attached a pic of the config screen. You'll see that "Default House Code for new sensors" is set for "R" (defaulted to this) and that I don't have any housecodes assigned to the plugin. Should I change something here? If I need to replace R38 (which was generated by mcsTemperature) with a different device that is generated by mcsTemperature with its housecode that shouldn't be too difficult.

                  UPDATE:
                  I went ahead and had mcsTemperature create its own housecodes. It assigned # and [. I then created a new thermostat device which created a [65 device. I changed my control to look at this thermostat and all went well. Then I tried to change the value of the thermostat with a script and it worked perfect. The learning was that if you want to change the thermostat value with a script it needs to be created by mcsTemperature using one of its own housecodes. Problem solved.

                  Thanks.
                  Attached Files
                  Last edited by beerguy; December 8, 2008, 01:16 PM.

                  Comment

                  Working...
                  X