Announcement

Collapse
No announcement yet.

Device That Triggered Script

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

    Device That Triggered Script

    This has been asked multiple times but I haven't found a solution to my problem. Basically, I need to know which device triggered a script. The solutions I found assume that the status of a device changes. However, in my case I am triggering a script when somebody clicks on an element in HSTouch, i.e. I set "Actions When Pressed" to "HomeSeer: Run a HomeSeer script with values from Device(s)". So just clicking on something does not create a status change and as such the proposed solutions don't work.

    I was looking into triggering an event instead (not sure if this will work because timing is critical) and then have the event trigger a script passing in the ID of the device that triggered the event. However, there also doesn't seem to be a way to figure out what device triggered an event (maybe I missed something).

    There has to be an easy solution for that since so many people are looking for this for many years.

    #2
    If I were facing this challenge I think I'd start by creating a unique event for each device (or button) that I wanted to track. Those events would all run the same master event with the desired actions - and each would also populate a virtual device with a value indicating what had triggered it. The master event could then reference the value of the virtual device.
    Mike____________________________________________________________ __________________
    HS3 Pro Edition 3.0.0.548, NUC i3

    HW: Stargate | NX8e | CAV6.6 | Squeezebox | PCS | WGL 800RF | RFXCOM | Vantage Pro | Green-Eye | Edgeport/8 | Way2Call | Ecobee3 | EtherRain | Ubiquiti

    Comment


      #3
      I have not done this myself as I haven't truly needed to know which HSTouch client triggered something. However, the unimplemented solution that I have in the back of my mind is the following.

      1. Create a new virtual device device in HS to hold the HSTouch client names. e.g. Tablet1, myphone, wifesphone, etc. Ensure logging is enabled for this device.
      2. On each HSTouch button you want to know which HSTouch client, on either the 'actions when pressed' or 'actions when released', add an action type to control a HS device, choose the new virtual device and set the value to the HSTouch's client name.

      When you want to determine which client triggered the change, review the HS log for the action of concern and you should see an additional log entry for the virtual device set to the client which triggered it.

      Certainly not a perfect solution, but should work.
      Len


      HomeSeer Version: HS3 Pro Edition 3.0.0.435
      Linux version: Linux homeseer Ubuntu 16.04 x86_64
      Number of Devices: 633
      Number of Events: 773

      Enabled Plug-Ins
      2.0.54.0: BLBackup
      2.0.40.0: BLLAN
      3.0.0.48: EasyTrigger
      30.0.0.36: RFXCOM
      3.0.6.2: SDJ-Health
      3.0.0.87: weatherXML
      3.0.1.190: Z-Wave

      Comment


        #4
        If the question is which HSTouch client initiated the request, see this thread. The scheme outlined in post #17 works pretty well, but it's a bit convoluted and clumsy.
        Mike____________________________________________________________ __________________
        HS3 Pro Edition 3.0.0.548, NUC i3

        HW: Stargate | NX8e | CAV6.6 | Squeezebox | PCS | WGL 800RF | RFXCOM | Vantage Pro | Green-Eye | Edgeport/8 | Way2Call | Ecobee3 | EtherRain | Ubiquiti

        Comment


          #5
          Apparently I have not been clear on what I want to achieve. I don't need to know which CLIENT triggered something. Instead I need to know which DEVICE trigged something. Consider the following:

          If "Device X" triggered, then "Control Device X" and set value A to B

          If I don't know what "Device X" is then I don't know what "Control Device X" is. Therefore, if I have 100 "Device X" then I have to setup 100 such identical conditions. However, if I know what "Device X" is then the above line becomes:

          device = "Device X"
          if device triggered, then "Control device" and set value A to B

          This will now work for all 100 devices instead of having to create identical statements for 100 such devices.

          In HSTouch this could be done with "Actions When Pressed" = "Action Type = HomeSeer: Fun a HomeSeer script" Script Parameter1 = "This Device's Reference ID". Now I can get the device ID as a parameter to my script and act on it. Even better would be if I can trigger an event, pass the device that triggered the event as an input and then let the event processor access that device. I think this is exactly what many people have been asking for in this forum.

          In any case, I am trying to implement this by setting the "Text" field of the devices to their "Device Reference". This is kind of a pain in the 'back' because you have to look up the ID with several mouse clicks. It also means you can't use the "Text" property anymore, i.e. you can't show any text because you are using this field for passing the ID to the script.

          Comment


            #6
            Originally posted by mulu View Post
            If "Device X" triggered, then "Control Device X" and set value A to B

            If I don't know what "Device X" is then I don't know what "Control Device X" is. Therefore, if I have 100 "Device X" then I have to setup 100 such identical conditions. However, if I know what "Device X" is then the above line becomes:

            device = "Device X"
            if device triggered, then "Control device" and set value A to B

            This will now work for all 100 devices instead of having to create identical statements for 100 such devices.

            In HSTouch this could be done with "Actions When Pressed" = "Action Type = HomeSeer: Fun a HomeSeer script" Script Parameter1 = "This Device's Reference ID". Now I can get the device ID as a parameter to my script and act on it. Even better would be if I can trigger an event, pass the device that triggered the event as an input and then let the event processor access that device. I think this is exactly what many people have been asking for in this forum.
            I think you are actually making this task more difficult by trying to pass a parameter from HSTouch to a script. I think it would be easier to have an HS event for each button. Each of the events can run the script and pass it the proper Ref ID.
            Mike____________________________________________________________ __________________
            HS3 Pro Edition 3.0.0.548, NUC i3

            HW: Stargate | NX8e | CAV6.6 | Squeezebox | PCS | WGL 800RF | RFXCOM | Vantage Pro | Green-Eye | Edgeport/8 | Way2Call | Ecobee3 | EtherRain | Ubiquiti

            Comment

            Working...
            X