Announcement

Collapse
No announcement yet.

Trigger question

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

    Trigger question

    I have an event that I want to trigger when I press Off on a UPB light switch. I had the trigger set to 'Changed to Off', but that would trigger only when the light was On when the switch is pressed, and I want it to trigger even if the light is off.

    I changed the trigger to 'Set to Off' and that seemed to do the trick, but today I discovered that the event triggers when I turn the switch on. (If I press On when the light is on, the event doesn't run, but it does run when I turn the light on, which I don't want to happen.)

    Is there a way to get an event to run when I press Off, regardless of whether the light is off or on?
    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

    #2
    I think I have a solution using a link. If I select the check box that all links are treated as change triggers, then I can use a Deactivate link to do what I want. At least it seems to work. The only puzzle is that although the event runs and the action is performed, the Last Ran entry remains "Unknown". Is that a bug or is there something I'm not doing correctly?
    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
      Unc Mike,

      I use a "slow" double tap to execute events. I do not see them run when I tap on, only off. I think there's something goofy with your setup.

      My double tap event is:
      Device Main Ent Room Overhead Plug is set to *OFF*

      It is set to cannot re-trigger for 2 seconds. I needed to add this as it seems the way I have links and switch reporting setup, I would tap off, the link for "I am off" would set Homeseer to OFF. Then the "LINK" would set the device to "OFF" in Homeseer. By adding this 2 second "ignore" period, it would prevent the double trigger from happening when I did not want it to.

      Finally the action is run script:
      "updateEvent.vb("entroom","EntPlugOff")"

      PHP Code:
         if(param "EntPlugOff"then
            
      if isDoubleTap("backHal"then
               
      if(hs.isOff(backHal)) then
                  hs
      .execx10(backHal"ON")
               else
                  
      hs.execx10(backHal"OFF")
               
      end if
            
      end if
            
         
      end if 
      The critical part of this is the function:
      isDoubleTap("backHal")

      PHP Code:
      Function isDoubleTap(ByVal par as object)
         
      Dim lastTime
         
         lastTime 
      getMyVar(par "DoubleTap")
         if(
      lastTime "NotSet"then
            setMyVar
      (par "DoubleTap|" Now)
            
      isDoubleTap FALSE
         
      elseif timeDiffGreaterThanSeconds(lastTime "|5")
            
      setMyVar(par "DoubleTap|" Now)
            
      isDoubleTap FALSE
         
      else
            
      isDoubleTap TRUE
         end 
      if

      End Function 
      That is part of my "uber" script that runs my house. It will return TRUE if the function is called with the same "name" within 5 seconds. Otherwise it returns FALSE.

      The last function you will need to add to the script would be
      timeDiffGreaterThanSeconds(lastTime & "|5")

      PHP Code:
      Function timeDiffGreaterThanSeconds(ByVal par as object)

         if (
      datediff("s",hs.stringitem(par1"|"), NOW) > hs.stringitem(par2"|")) then
            timeDiffGreaterThanSeconds 
      TRUE
         
      else
            
      timeDiffGreaterThanSeconds FALSE
         end 
      if

      End Function 
      This final script returns a TRUE if the time difference between what you give it and NOW is greater than the second parameter. Otherwise it is FALSE.

      So, if you add these three things (one sub, two functions) to a [something].vb, then call it as I did in the fourth paragraph, you should be able to get slow double taps working. As I said, the major key, was setting the 2 second do not re-trigger.

      If you need help, let me know. Sorry about the late reply; I was out of town until yesterday really late.

      --Dan
      P.S. if this doesn't work out, we can always wrap all the code in the Sub with an if that looks for hs.isOff("UPBDeviceCode").
      Tasker, to a person who does Homeautomation...is like walking up to a Crack Treatment facility with a truck full of 3lb bags of crack. Then for each person that walks in and out smack them in the face with an open bag.

      Comment


        #4
        UM,

        Forgot one part:
        getMyVar
        is actually another function I wrote. If you want to give all this code a try, let me know, I'll dig into the script and post this function as well.

        --Dan
        Tasker, to a person who does Homeautomation...is like walking up to a Crack Treatment facility with a truck full of 3lb bags of crack. Then for each person that walks in and out smack them in the face with an open bag.

        Comment


          #5
          Dan,
          Thanks for the reply. I actually have had a double tap working for some time. That turned out to be pretty easy. Double-tapping off on my switch deactivates a link, which turns off additional lights. I also found that using the link as a trigger worked with only a small bit of effort (mostly climbing the learning curve). That event adds an action to turn off the audio to the room as well as the lights.

          My puzzle is that the event, even though it runs - the audio does go off and the expected log entries get written - shows up on the events page with a Last ran entry of "Unknown".

          It's not a big deal, but I worry that minor glitches like this are an indication of a more fundamental problem, especially since I seem to be seeing lots of little discrepancies cropping up, some easy to ignore, some not.
          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


            #6
            Dan,
            Just to clarify, the original problem I had was that I was trying to use a single tap as a conventional HS trigger, but it looks like there are just two choices "Change to" and "Set to".

            If I choose the Change to Off trigger, then the event fires only if the light was on and I turn it off, but I want it to fire even if the light is off when the switch is tapped.

            If I choose the Set to Off trigger, then it works when I tap the switch off, regardless of whether the light is on or off, just as I want, but it also fires when I tap the switch on if the light is off, which I don't want to happen.

            The good news is that this forced me to start looking at UPB links and how they interact with HS a bit more closely. It's something I need to understand, but have been procrastinating.
            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


              #7
              UM,

              Little bit of experience, things will trigger when HS starts up, if you do not either have some kind of "Starting up" disable, or the double tap. As the UPB plugin reads the status of switches and "sets" them, you can get triggers to happen which will create some havoc (one reason I switched to doing slow-double and slow-triple taps). The other reason...I wanted more functions in a switch, and although I have US2-40's in the house, my wife does not really like a LOT of "stuff" on a switch, so I am limited to how many real buttons I can have based on WAF.



              --Dan
              Tasker, to a person who does Homeautomation...is like walking up to a Crack Treatment facility with a truck full of 3lb bags of crack. Then for each person that walks in and out smack them in the face with an open bag.

              Comment


                #8
                Originally posted by drozwood90 View Post
                Unc Mike,

                I use a "slow" double tap to execute events. I do not see them run when I tap on, only off. I think there's something goofy with your setup.

                My double tap event is:
                Device Main Ent Room Overhead Plug is set to *OFF*

                It is set to cannot re-trigger for 2 seconds. I needed to add this as it seems the way I have links and switch reporting setup, I would tap off, the link for "I am off" would set Homeseer to OFF. Then the "LINK" would set the device to "OFF" in Homeseer. By adding this 2 second "ignore" period, it would prevent the double trigger from happening when I did not want it to.

                Finally the action is run script:
                "updateEvent.vb("entroom","EntPlugOff")"

                PHP Code:
                   if(param "EntPlugOff"then
                      
                if isDoubleTap("backHal"then
                         
                if(hs.isOff(backHal)) then
                            hs
                .execx10(backHal"ON")
                         else
                            
                hs.execx10(backHal"OFF")
                         
                end if
                      
                end if
                      
                   
                end if 
                The critical part of this is the function:
                isDoubleTap("backHal")

                PHP Code:
                Function isDoubleTap(ByVal par as object)
                   
                Dim lastTime
                   
                   lastTime 
                getMyVar(par "DoubleTap")
                   if(
                lastTime "NotSet"then
                      setMyVar
                (par "DoubleTap|" Now)
                      
                isDoubleTap FALSE
                   
                elseif timeDiffGreaterThanSeconds(lastTime "|5")
                      
                setMyVar(par "DoubleTap|" Now)
                      
                isDoubleTap FALSE
                   
                else
                      
                isDoubleTap TRUE
                   end 
                if

                End Function 
                That is part of my "uber" script that runs my house. It will return TRUE if the function is called with the same "name" within 5 seconds. Otherwise it returns FALSE.

                The last function you will need to add to the script would be
                timeDiffGreaterThanSeconds(lastTime & "|5")

                PHP Code:
                Function timeDiffGreaterThanSeconds(ByVal par as object)

                   if (
                datediff("s",hs.stringitem(par1"|"), NOW) > hs.stringitem(par2"|")) then
                      timeDiffGreaterThanSeconds 
                TRUE
                   
                else
                      
                timeDiffGreaterThanSeconds FALSE
                   end 
                if

                End Function 
                This final script returns a TRUE if the time difference between what you give it and NOW is greater than the second parameter. Otherwise it is FALSE.

                So, if you add these three things (one sub, two functions) to a [something].vb, then call it as I did in the fourth paragraph, you should be able to get slow double taps working. As I said, the major key, was setting the 2 second do not re-trigger.

                If you need help, let me know. Sorry about the late reply; I was out of town until yesterday really late.

                --Dan
                P.S. if this doesn't work out, we can always wrap all the code in the Sub with an if that looks for hs.isOff("UPBDeviceCode").
                Here is a completed example of all the code needed to make this work (hope this helps people who find this through search)
                http://forums.homeseer.com/showpost....87&postcount=7

                --Dan
                Tasker, to a person who does Homeautomation...is like walking up to a Crack Treatment facility with a truck full of 3lb bags of crack. Then for each person that walks in and out smack them in the face with an open bag.

                Comment

                Working...
                X