Announcement

Collapse
No announcement yet.

HS2 to HS4 Scripting Global Variables

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

    HS2 to HS4 Scripting Global Variables

    In HS2 if you did a hs.GetVar(name) and the Global was not yet defined, the hs.GetVar() function returned "Name not found". This could then be used to initiate an hs.CreateVar(name).

    In HS4 this code structure throws an exception "A call was made to retrieve a global variable (1Wire) but there are none defined in the system. " and terminate the script.

    Did HS3/HS4 change the Gobal Variable scripting methodology? Another possible interpretation of the exception message is that there is an HS4 configuration parameter defining the number of possible Globals in the system, perhaps this is the case?

    TIA

    Best Regards

    #2
    A Global Variable in HS3 & HS4 store variables as an object so won't return any information.

    Even if a variable has been created before, repeating the hs.CreateVar command again is just ignored. To check content use:

    Code:
    hs.CreateVar("MyVar")
    If hs.GetVar("MyVar") = Nothing then
     ' Nothing stored in the variable
    Else
     ' Do something here
    End if
    Jon

    Comment


      #3
      Thanks for the quick tutorial. The patched code seems to be working ok.

      It's been a very long time since we corresponded! Is there an HS4 version of your excellent page builder application?

      I do have my HS2 configuration backups for reference if there is. As you may surmise, I missed out the whole HS3 cycle and my aged HomeTroller HS2 just expired😁

      Best Regards

      Comment


        #4
        Originally posted by Mark42 View Post
        Thanks for the quick tutorial. The patched code seems to be working ok.

        It's been a very long time since we corresponded! Is there an HS4 version of your excellent page builder application?

        I do have my HS2 configuration backups for reference if there is. As you may surmise, I missed out the whole HS3 cycle and my aged HomeTroller HS2 just expired😁

        Best Regards
        Yes, web page builder is available but the configuration changed from 2 columns to 3: https://forums.homeseer.com/forum/3r...r-3-homeseer-4

        You may also want to take a look at HSTile: https://forums.homeseer.com/forum/3r...ce-for-hs3-hs4
        Jon

        Comment


          #5
          Highly recommend HsTiles
          tenholde

          Comment

          Working...
          X