Announcement

Collapse
No announcement yet.

Script variable query

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

  • Script variable query

    Just taking the first tentative steps with scripting in HS3. I'm trying to use the replacement variable $$TIMER to speak the value of a two-minute timer called Light_Monitor_Timer.

    I'm using the syntax explained here: http://help.homeseer.com/help/HS3/st...ment_variables, thus:

    hs.Speak "Timer value is $$TIMER:Light_Monitor_Timer:"

    ... but what it actually speaks if I run it (at say 3pm) is "Timer value is three P M R light underscore monitor underscore timer" - in other words it's as though it's seeing $$time and speaking that before going on to speak the rest of the phrase, not recognising $$TIMER as a different command to $$time.

    Any light anyone can shed would be appreciated. I'm sure it's just a noob's typing mistake.



  • #2
    Replacement variables do not work inside of scripts. You need to use equivalent function calls instead.
    HS 3.0.0.548: 1976 Devices 1156 Events
    Z-Wave 3.0.1.262: 123 Nodes on one Z-Net

    Comment


    • #3
      Thanks Sparkman for the speedy response.

      The online help page for Replacemnt variables does not indicate that these cannot be used in scripts, and the Replacement Variable "$$time" works just fine in a script. So is it just Replacement Variables that have additional parameters, like $$TIMER and $$DSA that can't run in a script?

      Also, how would I go about using an equivalent function call, please.

      Comment


      • #4
        According to the page you linked, the variable needs a trailing ":" character, i.e. $$TIMER:Light_Monitor_Timer:

        Comment


        • #5
          Originally posted by MJH001 View Post
          Just taking the first tentative steps with scripting in HS3. I'm trying to use the replacement variable $$TIMER to speak the value of a two-minute timer called Light_Monitor_Timer.

          I'm using the syntax explained here: http://help.homeseer.com/help/HS3/st...ment_variables, thus:

          hs.Speak "Timer value is $$TIMER:Light_Monitor_Timer:"

          ... but what it actually speaks if I run it (at say 3pm) is "Timer value is three P M R light underscore monitor underscore timer" - in other words it's as though it's seeing $$time and speaking that before going on to speak the rest of the phrase, not recognising $$TIMER as a different command to $$time.

          Any light anyone can shed would be appreciated. I'm sure it's just a noob's typing mistake.

          You should be using hs.replacevariables in a script:

          Example:

          hs.Speak "Timer value is " & hs.replacevariables("$$TIMER:Light_Monitor_Timer:")
          Jon

          Comment


          • #6
            Originally posted by MJH001 View Post
            Thanks Sparkman for the speedy response.

            The online help page for Replacemnt variables does not indicate that these cannot be used in scripts, and the Replacement Variable "$$time" works just fine in a script. So is it just Replacement Variables that have additional parameters, like $$TIMER and $$DSA that can't run in a script?

            Also, how would I go about using an equivalent function call, please.
            Ok, perhaps the hs.speak command does invoke the replacement routine when it runs, but testing I have done before (and others with similar issues in the past) indicated none worked in script. Typically you would use the device value/string scripting commands: https://help.homeseer.com/help/HS3/s...or_last_change. Are you just doing an immediate script command in an event, or creating a full script (.vb file)?
            HS 3.0.0.548: 1976 Devices 1156 Events
            Z-Wave 3.0.1.262: 123 Nodes on one Z-Net

            Comment


            • #7
              Thanks zwolfpack - it was indeed the missing colon at the end. Note to jon00 and sparkman - the $$TIMER (and other replacment variables) work just fine in the script - which is just a txt file invoked from within an event. No need to use hs.replacevariables or devicevalue.

              Comment


              • #8
                Originally posted by MJH001 View Post
                Thanks zwolfpack - it was indeed the missing colon at the end. Note to jon00 and sparkman - the $$TIMER (and other replacment variables) work just fine in the script - which is just a txt file invoked from within an event. No need to use hs.replacevariables or devicevalue.
                Thanks for the update. Was your testing with the replacement variables inside the hs,speak command only?
                HS 3.0.0.548: 1976 Devices 1156 Events
                Z-Wave 3.0.1.262: 123 Nodes on one Z-Net

                Comment


                • #9
                  Yes, it was only inside an hs.Speak command.

                  Comment

                  Working...
                  X