Announcement

Collapse
No announcement yet.

Actions - Control a Counter

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

    Actions - Control a Counter

    Control a Counter


    Counter Actions are very similar to Timer Actions. When you choose Control a Counter for an action, you are presented with a second line where you can Create/Edit Counter, pick a counter that you have already created and select the action for the counter.





    If you choose Create/Edit Counters you will be presented with a popup where you can create a new counter -OR- select among counters you have already created.





    If you enter a new name in the dialogue it will check that it doesn't already exist and then create a new one.





    When you click "Save" on the dialogue, your new counter is created and will be selected as the counter of choice.





    If you click on Create/Edit Counters with a counter selected, the popup dialogue will offer you the additional option to rename it.



    There are six actions available for controlling a counter. A counter can be incremented or decremented a unit at a time or by a specific number of units.



    • Increment Counter - allows you to increase the counter by a single unit.
    • Decrement Counter - allows you to decrease the counter by a single unit.
    • Increment Counter by... - allows you to increase the counter by a specific number of units.
    • Decrement Counter by... - allows you to decrease the counter by a specific number of units.
    • Reset Counter - will set the counter to 0.
    • Set Counter to... - allows you to set the counter to a specific value.


    When you choose to increment or decrement by a specific value -or- you want to set the counter to a specific value, you will be presented with an additional window to enter that value.






    HS4 Pro, 4.2.19.0 Windows 10 pro, Supermicro LP Xeon

    #2
    While I use timers, I haven't seen any need for counters. Assuming a relatively basic system (and with no scripts), what would be some applications/usage scenarios for counters?

    Comment


      #3
      Originally posted by mikedr View Post
      While I use timers, I haven't seen any need for counters. Assuming a relatively basic system (and with no scripts), what would be some applications/usage scenarios for counters?
      One thing I use them for is in conjunction with a timer - so that I can count the number of times a MiniMote button is pressed within a specific period of time, or counting ON-OFF actions of light switches within a short period of time to control my motion controlled lighting. Here is a thread that goes through how I handle most of my indoor motion controls. On my MiniMotes I have created a third option for each of the buttons. Press once to turn a light ON to a preset level, then a single press steps the dimmer up by 10%, a double press within 2 seconds steps the dimmer down by 10% and a long press shuts the light off. The double press requires a counter ad a timer to work. We have 6 MiniMotes around the house and the actions on all of them are the same for a high WAF The two in the bedroom have a triple press on any button that enables a "panic mode" and lights up the entire inside and outside of the house. You can use them to count the number of times a door opens, a device (like a furnace) cycles or a switch is controlled. I mostly use them in conjunction with a timer, counting actions within a specific amount of time. They don't have a broad range of use, but they are useful.
      HS4 Pro, 4.2.19.0 Windows 10 pro, Supermicro LP Xeon

      Comment


        #4
        I like the idea of the minimote panic mode. I'm assuming that after the last "press" you have an event that resets the counter after "X" seconds/minutes?

        Comment


          #5
          Originally posted by mikedr View Post
          I like the idea of the minimote panic mode. I'm assuming that after the last "press" you have an event that resets the counter after "X" seconds/minutes?
          With all button press events there is an event that triggers after XX seconds to reset the counter and stop the timer - just in case one of the button counting events fails to trigger. For the panic mode, the rule is more than 2 presses within 4 seconds initiates the event, stops the timer and resets the counter, so the reset is at 5 seconds. It is redundant, because the 1 second timer will look for a single or two presses, either of which will trigger the event, reset the counter and the timer. So when the timer reaches 1 second and there are either 1 or two presses, the whole thing stops. If it is more than two presses then it continues to 4 seconds, at which point the event is triggered, the counter and timer are reset.
          Attached Files
          Last edited by randy; March 8, 2015, 08:18 PM.
          HS4 Pro, 4.2.19.0 Windows 10 pro, Supermicro LP Xeon

          Comment


            #6
            i use counters for my motion off events so if you just walk through a room the lights don't stay on for long but the longer you are in the room the longer the lights will stay on

            i have an event that starts a timer and decrements a counter any time it sees motion (for the hard wired motion sensors i have the advanced setting enabled so it can't run again for 30sec so you don't rack up the counter too fast)


            Click image for larger version

Name:	Counter Event Motion Capture.JPG
Views:	1
Size:	34.8 KB
ID:	1178137

            then i have the main event setup like this

            Click image for larger version

Name:	Counter Event Capture.JPG
Views:	1
Size:	170.2 KB
ID:	1178136
            so the more times it sees you in the room the longer the lights will stay on (helpful if you are soldering or something where you aren't always moving around)
            You have to decrement the counter as there are not as many options with counters as timers so if you want it to run if less than a value you have to be creative and use the decrement option but i hope they add more features later so we don't have to do this

            Comment


              #7
              Originally posted by rprade View Post
              With all button press events there is an event that triggers after XX seconds to reset the counter and stop the timer - just in case one of the button counting events fails to trigger. For the panic mode, the rule is more than 2 presses within 4 seconds initiates the event, stops the timer and resets the counter, so the reset is at 5 seconds. It is redundant, because the 1 second timer will look for a single or two presses, either of which will trigger the event, reset the counter and the timer. So when the timer reaches 1 second and there are either 1 or two presses, the whole thing stops. If it is more than two presses then it continues to 4 seconds, at which point the event is triggered, the counter and timer are reset.
              Randy, are you still using this event for your minimotes? I have 5 minimotes and would like to use this if at all possible, looking at your event you use a dimchange.vb script would you be so kind and share it? Mike
              Computer: CUK Intel NUC7i7BNH
              Op System: Windows10 Pro - Work Station
              HS Version: HS4 Pro Edition 4.2.19.0

              Plug-Ins: AK Weather 4.0.5.25,APCUPSD 3.3.2.3,BLBackup 2.0.63.0,BLEditor 2.0.11.0,BLGData 3.0.55.0,BLOccupied 2.0.28.0,BLShutdown 1.0.6.0,Blue-Iris 3.1.3.33206,Device History 3.2.0.2,EasyTrigger 3.0.0.76,Harmony Hub 4.0.14.0,iRobot 5.22.41.1,JowiHue 4.0.8.7,Nest 3.0.0.34,NetCam Plugin 1.0.0.5,PHLocation2 3.0.0.64,Pushover 4.0.10.0,Random 3.0.0.2,Restart 1.0.0.7,Ring 1.0.0.9,SDJ-Health 3.1.1.3,Sonos 3.1.0.59,Sonos4 4.0.1.12,UltraCID3 3.0.6681.34300,UltraMon3 3.0.6554.33094,UltraNetCam3 3.0.6413.20219,Unifi 4.0.32.0,Zigbee 4.0.11.0,Z-Wave 4.0.3.0, and Jon00 scripts.

              Comment


                #8
                Originally posted by MNB View Post
                Randy, are you still using this event for your minimotes? I have 5 minimotes and would like to use this if at all possible, looking at your event you use a dimchange.vb script would you be so kind and share it? Mike
                Yes I am. Though after Spud's Easy Trigger offered a toggle function, we have moved to that for some of the lights. The toggle in Easy Trigger lets you rotate among a number of preset levels. In those cases I still use the DimChange script to allow a double press to reduce the level. The DimChange script is not mine, I cannot remember where I originally found it. It is very simple:
                Code:
                 Sub Main(ByVal inputparms as String)
                        ' parameter "1234,10" device Reference ID followed by percentage change "-" for down
                	dim pos = InStr(inputparms, ",")
                	dim strSize = Len(inputparms)
                	dim targetDev as Double = Left(inputparms, pos - 1)
                	dim targetDim as Double = Right(inputparms, strSize - pos)   
                	dim debugmode as Boolean = True
                	Dim devValue As Double
                	devValue = hs.DeviceValue(targetDev) + targetDim
                
                	hs.writelog("Dim Script",CStr(devValue))
                	hs.CAPIControlHandler(hs.CAPIGetSingleControl(targetDev, false, CStr(devValue), false, true))
                
                End Sub
                Just pass the parameters as ReferenceID,percentage up or down. Parameter "5103,-10" (without quotes) would reduce device 5103 by 10% and "5103,10" would raise them by 10%. There are no traps in the script limiting the range, but I think CapiControl prevents the device from being set out of range.
                HS4 Pro, 4.2.19.0 Windows 10 pro, Supermicro LP Xeon

                Comment


                  #9
                  Thank-you much sir, I will utilize it. I had wanted to change my current two state per button to a four state per button (low priority) and this will help facilitate the move. Mike
                  Computer: CUK Intel NUC7i7BNH
                  Op System: Windows10 Pro - Work Station
                  HS Version: HS4 Pro Edition 4.2.19.0

                  Plug-Ins: AK Weather 4.0.5.25,APCUPSD 3.3.2.3,BLBackup 2.0.63.0,BLEditor 2.0.11.0,BLGData 3.0.55.0,BLOccupied 2.0.28.0,BLShutdown 1.0.6.0,Blue-Iris 3.1.3.33206,Device History 3.2.0.2,EasyTrigger 3.0.0.76,Harmony Hub 4.0.14.0,iRobot 5.22.41.1,JowiHue 4.0.8.7,Nest 3.0.0.34,NetCam Plugin 1.0.0.5,PHLocation2 3.0.0.64,Pushover 4.0.10.0,Random 3.0.0.2,Restart 1.0.0.7,Ring 1.0.0.9,SDJ-Health 3.1.1.3,Sonos 3.1.0.59,Sonos4 4.0.1.12,UltraCID3 3.0.6681.34300,UltraMon3 3.0.6554.33094,UltraNetCam3 3.0.6413.20219,Unifi 4.0.32.0,Zigbee 4.0.11.0,Z-Wave 4.0.3.0, and Jon00 scripts.

                  Comment


                    #10
                    Randy, after reviewing the DimChange.vb it has a comment "' parameter "1234,10" device Reference ID followed by percentage change "-" for down" I do not see where you are inputting a device Reference ID along with a percentage change, what am I missing?

                    Also if I understand the events they are for only one button sooo that means that we would need a set (5) of these events per button?
                    Computer: CUK Intel NUC7i7BNH
                    Op System: Windows10 Pro - Work Station
                    HS Version: HS4 Pro Edition 4.2.19.0

                    Plug-Ins: AK Weather 4.0.5.25,APCUPSD 3.3.2.3,BLBackup 2.0.63.0,BLEditor 2.0.11.0,BLGData 3.0.55.0,BLOccupied 2.0.28.0,BLShutdown 1.0.6.0,Blue-Iris 3.1.3.33206,Device History 3.2.0.2,EasyTrigger 3.0.0.76,Harmony Hub 4.0.14.0,iRobot 5.22.41.1,JowiHue 4.0.8.7,Nest 3.0.0.34,NetCam Plugin 1.0.0.5,PHLocation2 3.0.0.64,Pushover 4.0.10.0,Random 3.0.0.2,Restart 1.0.0.7,Ring 1.0.0.9,SDJ-Health 3.1.1.3,Sonos 3.1.0.59,Sonos4 4.0.1.12,UltraCID3 3.0.6681.34300,UltraMon3 3.0.6554.33094,UltraNetCam3 3.0.6413.20219,Unifi 4.0.32.0,Zigbee 4.0.11.0,Z-Wave 4.0.3.0, and Jon00 scripts.

                    Comment


                      #11
                      Originally posted by MNB View Post
                      Randy, after reviewing the DimChange.vb it has a comment "' parameter "1234,10" device Reference ID followed by percentage change "-" for down" I do not see where you are inputting a device Reference ID along with a percentage change, what am I missing?

                      Also if I understand the events they are for only one button sooo that means that we would need a set (5) of these events per button?
                      When you run a script within an event click on the advanced button to expand the options where you can enter a function and parameters

                      Click image for larger version

Name:	Capture.jpg
Views:	1
Size:	66.4 KB
ID:	1192190

                      For this script there are no functions or subs, so you only need to enter the parameters.

                      Yes, without writing a script, it takes 5 or 6 events, one timer and one counter per button. We use 6 because a single press of the button will behave differently when the light is Off vs when it is On. If it is Off a single press turns the light on to a default brightness. If it is already On it will bump the dim level - either with Easy Trigger toggle or with the DimChange script.
                      HS4 Pro, 4.2.19.0 Windows 10 pro, Supermicro LP Xeon

                      Comment


                        #12
                        Randy, thanxs for the explanation, I should have known better as I've run a number of scripts within events, it late and I'm slowing down... "ja that's the ticket!" Based on your confirmation of multiple events per button, I will get to work and attempt to build and setup the events. Mike
                        Computer: CUK Intel NUC7i7BNH
                        Op System: Windows10 Pro - Work Station
                        HS Version: HS4 Pro Edition 4.2.19.0

                        Plug-Ins: AK Weather 4.0.5.25,APCUPSD 3.3.2.3,BLBackup 2.0.63.0,BLEditor 2.0.11.0,BLGData 3.0.55.0,BLOccupied 2.0.28.0,BLShutdown 1.0.6.0,Blue-Iris 3.1.3.33206,Device History 3.2.0.2,EasyTrigger 3.0.0.76,Harmony Hub 4.0.14.0,iRobot 5.22.41.1,JowiHue 4.0.8.7,Nest 3.0.0.34,NetCam Plugin 1.0.0.5,PHLocation2 3.0.0.64,Pushover 4.0.10.0,Random 3.0.0.2,Restart 1.0.0.7,Ring 1.0.0.9,SDJ-Health 3.1.1.3,Sonos 3.1.0.59,Sonos4 4.0.1.12,UltraCID3 3.0.6681.34300,UltraMon3 3.0.6554.33094,UltraNetCam3 3.0.6413.20219,Unifi 4.0.32.0,Zigbee 4.0.11.0,Z-Wave 4.0.3.0, and Jon00 scripts.

                        Comment

                        Working...
                        X