No announcement yet.

Using Scripting with HSTouch

This topic is closed.
This is a sticky topic.
  • Filter
  • Time
  • Show
Clear All
new posts

    Using Scripting with HSTouch

    See also this HowTo article that has more information on using VBScript statements to modify text elements:

    The following pertains to HSTouch version and HSTouch Server Plug-In, HomeSeer or later is also required.

    In order to make HSTouch as flexible as possible, you have the option of adding script to HSTouch. There are 2 ways to use scripting:

    1) One of the actions available when pressing an element is to run a script. This allows you to pass parameters to a specific script and have HomeSeer run it. The parameters can be values from an element, such as the value of a slider.

    2) You can also add script statements to the text property of a button. This allows you to set the text display based on the return value of the statement, or simply apply some math to the return value.

    For example, you have a device in HomeSeer that holds the temperature but the value is a factor of 10 off, such as 731 for 73.1. If the value is used as is, it will display 731 which is not correct. To fix it, you can set the text propery of your label to:


    Where "Q1" is the device reference ID of your HomeSeer device. The above statement gets the value of Q1 divides it by 10, then sets the result to the text property of the element. You can add extra text if you like such as:

    Temperature inside is [$SCRIPT=&hs.DeviceValue("Q1")/10]

    If you want to execute a command in HomeSeer, such as sending an IR command, enter the script statement as an action. Add a new action to your button and select the HomeSeer Script action. For the script name, just enter your script statement like:

    &hs.sendir "TV,ON"

    To speak out the HomeSeer system:

    &hs.speak "hello from HSTouch"
    website | buy now | support | youtube