Announcement

Collapse
No announcement yet.

Passing Element Values from HSTouch to Virtual Device

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

    Passing Element Values from HSTouch to Virtual Device

    Hello,

    I'm trying to pass a user-entered numeric value on HSTouch to a Virtual Device. I'd like to use the user entered value to set the state of the virtual device.

    For example, if I have various states setup on the device (0, 1, 2, etc.) I'd like the user to be able to enter a number and pass it back to set the virtual device state. Has anyone found a good method to do this?

    I've tried associating a text box with a virtual device with no luck (maybe because the values can be more than just numeric?). I've been trying to avoid going the script route, but it looks like that may be an option as HSTouch elements values can be sent as parameters to a script, and presumably I can then set a device state based on the parameter within the script. I've not done any scripting with HomeSeer, but I expect it isn't THAT difficult?

    Any thoughts would be appreciated.

    #2
    Easy peasy-ish.

    You pass the entered value from HSTouch to a script, then have the script save the value in a virtual device. Here's a script I use for updating an alarm timer:

    Code:
    Sub Main(ByVal parm As Object)
    
    	Dim inputcode
    	' Get new alarm timeout from HSTouch
    	inputcode = parm(0).ToString ' get input code
    	Dim NewTimeout
    	NewTimeout = inputcode
    
    	If NewTimeout < 15 then
    		hs.Speak("Delay must be at least 15 seconds")
    	Else		
    		hs.SetDeviceStringByName("AlarmTimeout",NewTimeout,true)
    		hs.Speak("Arming delay changed to " & NewTimeout & " seconds")
    	End If	
    
    End Sub

    Comment


      #3
      Originally posted by jgreenberg01 View Post
      Easy peasy-ish.

      You pass the entered value from HSTouch to a script, then have the script save the value in a virtual device. Here's a script I use for updating an alarm timer:

      Code:
      Sub Main(ByVal parm As Object)
      
      Dim inputcode
      ' Get new alarm timeout from HSTouch
      inputcode = parm(0).ToString ' get input code
      Dim NewTimeout
      NewTimeout = inputcode
      
      If NewTimeout < 15 then
      hs.Speak("Delay must be at least 15 seconds")
      Else
      hs.SetDeviceStringByName("AlarmTimeout",NewTimeout,true)
      hs.Speak("Arming delay changed to " & NewTimeout & " seconds")
      End If
      
      End Sub
      Thank you! Yes, my assumption here was that I may need to resort to a script.

      I'll need to take a look at the scripting documentation and give it try that way. Thanks for the reply!

      Comment


        #4
        So, it looks like the scripting documentation is very thin - am I missing something, perhaps? Can someone point me at a comprehensive set of documentation around the hs libraries? What I've seen online is very basic and only provides high level examples but nothing comprehensive to allow me to discover all of the functions for interacting with devices.

        Thanks - apologies if I'm just missing it!

        Comment


          #5
          http://help.homeseer.com/help/HS3/static/#.scripting

          https://homeseer.github.io/Plugin-SD...r.html?tabs=cs

          tenholde

          Comment


            #6
            Thank you - I'll take a look there!

            Comment

            Working...
            X