Announcement

Collapse
No announcement yet.

Button pushes generated by the server?

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

    Button pushes generated by the server?

    I am new to HSTouch, running HS 2.5 and HSTouch Server 1.0.0.72. I program a button to trigger a short script (by putting an 'hs.run' command in the text field of the button) and it triggers the script every time I push the button. But then a very strange thing happens - the script continues to be triggered every few minutes without any button presses, and this continues unabated until I shut down the server (shutting down the client plugins does not stop the behavior).

    I also observed some other odd behavior which might be related - when I pressed the button it appeared that the script executed twice each time.

    I did install HSTouch twice, the second time without removing it from HS beforehand. I assumed, perhaps incorrectly, that the second installation would simply overwrite the first, but I have seen posts that talk about duplicate client connections and wonder if this could be a similar problem?

    Does anyone have any ideas as to how I can fix this? I will obviously uninstall HSTouch completely and try to re-install it - but beyond this? Has anyone experienced this problem? I can't find anything similar on the forum.

    Thanks in advance for your help.

    #2
    Can't say I have ever seen this but is there by chance something else in the script causing it to re-trigger? When it re-triggers is it at a clean interval like every minute or at a random interval?

    I would want to make sure it was not something outside of HS that was triggering it like an event.

    Comment


      #3
      It appears to be random, and I doubt it is being "re-triggered" by the script, which consists solely of the following:
      hs.writelog "Test Before", hs.devicestring("C1")
      hs.setdevicestring "C1", (hs.devicestring("C1") + 1)
      hs.writelog "Test After", hs.devicestring("C1")

      Interestingly, the device (C1) is incrementing even when the script is not running (you can see this when the counter increases in value over a few minutes without any of the logging taking place). I think this is due to a second button which directly increments the device, rather than running a script which increments it. What this says to me is that HSTouch is simulating button presses, of one button (triggering the increment script) or the other button (triggering a direct increment) without my actually pressing the button. Or alternatively, that when I press the button briefly, the client or the server is interpreting that as multiple button presses, and then is slowly queuing them for execution over time.

      I realize this sounds absurd, but I can't think of anything else that could cause this, other than HS figuring out that I want to increment a counter and has decided to help me out on its own. Which would be a really cool feature.

      Here's the log file showing the counter incrementing. Most of these runs of the script were not triggered manually.

      12/23/2014 10:38:40 PM HSTouch Server Client Android:Kitchen (192.168.0.102/43341) has disconnected.
      12/23/2014 10:38:40 PM Plug-In Shutting down generic Plug-In: HSTouch Server
      12/23/2014 10:35:26 PM Test After 128
      12/23/2014 10:35:26 PM Test Before 127
      12/23/2014 10:33:43 PM Plug-In Shutting down generic Plug-In: HSTouch iPhone
      12/23/2014 10:33:34 PM Plug-In Shutting down generic Plug-In: HSTouch Android
      12/23/2014 10:30:24 PM Test After 120
      12/23/2014 10:30:24 PM Test Before 119
      12/23/2014 10:25:22 PM Test After 110
      12/23/2014 10:25:22 PM Test Before 109
      12/23/2014 10:24:04 PM Test After 107
      12/23/2014 10:24:04 PM Test Before 106
      12/23/2014 10:24:00 PM HSTouch Server Client Android (192.168.0.102/43341) named Kitchen has CONNECTED.
      12/23/2014 10:23:59 PM HSTouch Server Opening connection from:192.168.0.102/43341
      12/23/2014 10:23:59 PM HSTouch Server IP address connecting: 192.168.0.102 port:43341
      12/23/2014 10:23:45 PM HSTouch Server Client Android named Kitchen has DISCONNECTED.
      12/23/2014 10:23:45 PM HSTouch Server Client Android:Kitchen (192.168.0.102/56700) has disconnected.
      12/23/2014 10:23:45 PM HSTouch Server Warning Client dropped connection 192.168.0.102/56700
      12/23/2014 10:21:30 PM Test After 104
      12/23/2014 10:21:30 PM Test Before 103
      12/23/2014 10:21:26 PM HSTouch Server Client Android (192.168.0.102/56700) named Kitchen has CONNECTED.
      12/23/2014 10:21:26 PM HSTouch Server Opening connection from:192.168.0.102/56700
      12/23/2014 10:21:26 PM HSTouch Server IP address connecting: 192.168.0.102 port:56700
      12/23/2014 10:21:26 PM HSTouch Server IP address connecting: 192.168.0.102 port:56700
      12/23/2014 10:21:26 PM HSTouch Server IP address connecting: 192.168.0.102 port:56700
      12/23/2014 10:20:30 PM HSTouch Server Client Android named Kitchen has DISCONNECTED.
      12/23/2014 10:20:30 PM HSTouch Server Client Android:Kitchen (192.168.0.102/59012) has disconnected.
      12/23/2014 10:20:30 PM HSTouch Server Warning Client dropped connection 192.168.0.102/59012
      12/23/2014 10:19:51 PM HSTouch Server Client vtBasementNew named vtBasementNew has DISCONNECTED.
      12/23/2014 10:19:51 PM HSTouch Server Client vtBasementNew:vtBasementNew (192.168.0.25/50976) has disconnected.
      12/23/2014 10:14:58 PM Test After 99
      12/23/2014 10:14:58 PM Test Before 98
      12/23/2014 10:09:56 PM Test After 93
      12/23/2014 10:09:56 PM Test Before 92
      12/23/2014 10:04:54 PM Test After 86
      12/23/2014 10:04:54 PM Test Before 85

      Comment


        #4
        Even if HSTouch was pressing the button by itself the script should run and put the test entries into the log. HSTouch is not clever enough by itself to increment the value without running the script. In the element actions are you sure you just have one action on the actionwhenpressed/actionwhenreleased editor?

        Do you have another C1 device anywhere in your HS system at all anywhere (hidden from view or whatever)?

        Comment


          #5
          I have no other processes using device C1, and I've now set up the system so there is only a single button, with only a single action in the text field:

          [$SCRIPT=&hs.run "test.txt"]

          I've discovered it is the client that is triggering the script. As soon as I disconnect the client from the server the script stops running - otherwise, it runs every 15 to 45 seconds at random intervals.

          Even HSTouch Designer causes the same problem - as soon as it connects to the server it starts triggering the script to run, without any button presses.

          Comment


            #6
            Right...that will be why, anything enclosed in [$SCRIPT tags is designed to really return a value (like [$SCRIPT=&hs.sunrise()] will put the sun rise time in a text element) rather than set something. It used to run at once a second but guess you might be either over loading it or it has changed.

            What you need to do is click on the button, then click ActionsWhenReleased in the element properties pane. Add an action to 'Run A HomeSeer Script With Values From Elements' and then select the script. That will run the script when the button is pressed.

            Comment


              #7
              Excellent, thanks so much. The documentation for scripting with HSTouch seems a bit spotty, and the only instructions I could find indicated the use of the Text field.

              One quick question: is there a reason you suggested putting the script in the 'ActionsWhenReleased' section instead of in the 'ActionsWhenPushed' section? Not that I intend to hold down the button for very long, but wouldn't the script execute just a little sooner if the instruction was executed upon pushing instead of releasing?

              Thanks again for your help.

              Comment


                #8
                It's honestly personal preference whether you want it on release or on push, there is nothing set in stone about it. I think it was advised that you used released because if you had a pressed graphic set up than you would see this graphic when you pressed the button and then the action done when you lifted your finger (so providing visual feedback) and the button went back to it's state. If you used when pressed then the button would not changed it's image until after the action...or something like that anyway.

                Comment

                Working...
                X