Announcement

Collapse
No announcement yet.

Setting Stargate Variables

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

    Setting Stargate Variables

    I'm trying to set some stargate variables from a script using SetDeviceValueByName, which I believe was working at one point in time. However, it no longer works. The log indicates that it is successful, and the status display reflects the changes value, but both WinEVM and my Web Xpander both show that no change has taken place. I have checked my JDS.ini file and the proper housecode is reflected for the first set of variables ('['). Setting it using the Web control interface will also fail to change the Stargate variable. Setting of flags seems to be working fine.

    #2
    I think there may have been a problem with that command. My work around is to do this:

    'The following commands look up device codes for use in this script
    'The lookup string is not case sensitive

    'FLAG codes from Stargate used in this script

    trashtime= hs.GetDeviceCode("JDS trashtime") 'indicate whether trash is due to be taken out

    'VARIABLE codes from Stargate used in this script

    PoolTempVar = hs.GetDeviceCode("JDS Pool Temp")
    SpaTempVar = hs.GetDeviceCode("JDS Spa Temp")
    OutdoorMusicModeVar = hs.GetDeviceCode("JDS OutdoorMusicMode")

    'RELAY codes from Stargate used in this script
    PagingDev = hs.GetDeviceCode("JDS PagingOn")

    Once I have defined all the device codes using hs.GetDeviceCode, then I use them as follows:

    PoolTemp = hs.DeviceValue(PoolTempVar)
    SpaTemp = hs.DeviceValue(SpaTempVar)
    Last edited by timlacey; July 29, 2007, 09:37 AM. Reason: cleaned up script

    Comment


      #3
      I recently ran into the same problem. In addition to the method Tim uses, I also have found two other methods that appear to work.

      hs.SetDeviceValue will work (using the device code) That is,
      hs.SetDeviceValue "Q19", 26
      will set the value of the device with code Q19 to the value of 26.

      I believe the way that is officially recommended is to use the ExecX10 Preset Dim function. That is,
      hs.ExecX10 "Q19", "preset dim", 26
      will also set Q19 to 26.
      Mike____________________________________________________________ __________________
      HS3 Pro Edition 3.0.0.548, NUC i3

      HW: Stargate | NX8e | CAV6.6 | Squeezebox | PCS | WGL 800RF | RFXCOM | Vantage Pro | Green-Eye | Edgeport/8 | Way2Call | Ecobee3 | EtherRain | Ubiquiti

      Comment


        #4
        I have tried all of Tim's and Mike's methods, however the Stargate variable never changes. Note that Homeseer thinks it changes as reflected in both the log and the status page, so any Homeseer events/triggers etc. would think it changed as well. Tim, Mike - are you sure that your variable change is reflected in Stargate as well? There would be no way of telling unless you trigger something in the Stargate schedule based upon the variable change or you look at the value in the Web Xpander or WinEVM.

        Comment


          #5
          Ken,
          How are you determining that the variable is not changing in SG?

          This is the experiment I ran. I created two variables in SG, then imported them into HS. In SG I defined an event that transfers the value of one variable to the other (Temp3 to UserVar, then UserVar to Debug). I then used an instant script to change the value of the variables in HS. Here are snippets of the resulting HS log:

          7/27/2007 3:11:59 PM ~!~Info~!~Running script statement immediately: &hs.SetDeviceValue "`6", 5
          7/27/2007 3:11:59 PM ~!~JDS StarGate~!~Variable `6 (JDS Temp3) set to 5
          7/27/2007 3:12:00 PM ~!~JDS StarGate~!~Load variable `26 (JDS Debug) with 5
          Note that this command works as expected.

          7/27/2007 3:17:55 PM ~!~Info~!~Running script statement immediately: &hs.ExecX10 "`6", "on", 6
          7/27/2007 3:17:55 PM ~!~JDS StarGate~!~Variable `6 (JDS Temp3) set to 6
          7/27/2007 3:17:56 PM ~!~JDS StarGate~!~Load variable `26 (JDS Debug) with 1
          This command seems to work, but it replaces the value specified in the script with a 1 (for 'ON', I presume).

          7/27/2007 5:06:10 PM Info Running script statement immediately: &hs.ExecX10 "`6", "Preset Dim", 8
          7/27/2007 5:06:10 PM JDS StarGate Variable `6 (JDS Temp3) set to 8
          7/27/2007 5:06:11 PM JDS StarGate Load variable `26 (JDS Debug) with 8
          This seems to work just like SetDeviceValue.
          Mike____________________________________________________________ __________________
          HS3 Pro Edition 3.0.0.548, NUC i3

          HW: Stargate | NX8e | CAV6.6 | Squeezebox | PCS | WGL 800RF | RFXCOM | Vantage Pro | Green-Eye | Edgeport/8 | Way2Call | Ecobee3 | EtherRain | Ubiquiti

          Comment


            #6
            Mike,
            I was verifying variable changes by observing updates using the Web Xpander. I repeated your verification steps and essentially verified that my configuation was not working.

            So I deleted all my JDS devices, shut down Homeseer, deleted the JDS.ini, and re-imported everything letting the latest plug-in assign things properly. I've had to do this before, but evidently with all the plug-in changes recently along with importing with various versions of the plug-in along the way - things just were screwed up. It is now functioning properly.

            Thanks for your help...and Tim's too.

            Comment


              #7
              Mike,

              Just as a follow-up since I know you linked another thread to this one about the SetDeviceByName function, after performing the steps I identifed in my last post, SetDeviceByName functions normally as identified by the following log output:

              8/5/2007 7:39:13 PM ~!~Info~!~Event Trigger "Test Variable Update"
              8/5/2007 7:39:13 PM ~!~Info~!~Running script statement immediately: &hs.setDeviceValueByName "JDS Debug1", 10
              8/5/2007 7:39:13 PM ~!~JDS StarGate~!~Variable \8 (JDS Debug1) set to 10
              8/5/2007 7:39:13 PM ~!~JDS StarGate~!~Load variable \9 (JDS Debug2) with 10

              So you might try the steps yourself to see if it solves your problem with this function.

              Comment


                #8
                Cool! Perhaps I'll get up the nerve to try it (after appropriate backups, of course). Are you using the latest plugin version from the updater or one that RJ provided separately?
                Mike____________________________________________________________ __________________
                HS3 Pro Edition 3.0.0.548, NUC i3

                HW: Stargate | NX8e | CAV6.6 | Squeezebox | PCS | WGL 800RF | RFXCOM | Vantage Pro | Green-Eye | Edgeport/8 | Way2Call | Ecobee3 | EtherRain | Ubiquiti

                Comment


                  #9
                  I'm using HS 2.2.0.11 | Stargate 2.1.2614.17538 - the ones provided by the updater. The only pain with doing this is adding all of the JDS variables, flags etc back into all of the events. If anybody knows an 'easy' way of going this I would like to hear about it.

                  Comment


                    #10
                    Originally posted by kecarbaugh View Post
                    The only pain with doing this is adding all of the JDS variables, flags etc back into all of the events. If anybody knows an 'easy' way of going this I would like to hear about it.
                    That's the big hurdle for me. I wonder if shutting down HS after reimporting the devices from Stargate and then replacing the .mdb file with one that was saved before removing the devices would do the trick. Obviously, it would be critical to do an import just before making the backup copy and then not changing anything other than deleting and reimporting SG devices. Has anyone tried that?
                    Mike____________________________________________________________ __________________
                    HS3 Pro Edition 3.0.0.548, NUC i3

                    HW: Stargate | NX8e | CAV6.6 | Squeezebox | PCS | WGL 800RF | RFXCOM | Vantage Pro | Green-Eye | Edgeport/8 | Way2Call | Ecobee3 | EtherRain | Ubiquiti

                    Comment

                    Working...
                    X