Announcement

Collapse
No announcement yet.

Reset counter

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

    Reset counter

    I use a counter in a group of events. But, one function refuses to work -- 'Reset counter'. The other 'Then' entries work properly.
    I also tried it in the first and second 'Then' position, and 'Set counter to 0'. I even tried it in its own event (i.e. "If floorswitch becomes 2; then reset floorswitch")
    I also tried 'Decrement counter by 2' -- no joy.

    Note that it does work properly if I click the Run button.

    Why doesn't it run?
    Attached Files
    Last edited by MichaelK; September 19, 2017, 12:30 PM. Reason: Added 2 items.

    #2
    I've had counters act silly like this. I would delete the counter and create a new one with a different name and see how that works.

    Comment


      #3
      Ok, I created a new counter, and changed all of the events to use it. It still refuses to reset.

      It occurred to me that, maybe, an event cannot modify a counter that triggered it. So, I created a manually-triggered event that resets the counter. Then, set up the main event to call it. Guess what! Still no joy.

      Is it possible that I've found a bug? Someone must have noticed this by now.

      Can someone confirm that counters actually work like I'm expecting?

      Comment


        #4
        What version of HomeSeer are you using?
        Billy

        Comment


          #5
          Originally posted by bdraper View Post
          What version of HomeSeer are you using?
          3.0.0.357

          Comment


            #6
            Originally posted by MichaelK View Post
            Ok, I created a new counter, and changed all of the events to use it. It still refuses to reset.

            It occurred to me that, maybe, an event cannot modify a counter that triggered it. So, I created a manually-triggered event that resets the counter. Then, set up the main event to call it. Guess what! Still no joy.

            Is it possible that I've found a bug? Someone must have noticed this by now.

            Can someone confirm that counters actually work like I'm expecting?
            I have dozens of counters in my system and have never had a problem controlling them, including reset. I have several counters that must reset many times per day or I will be getting pushover messages, bathroom fans will not start any number of things would crop up if counters were failing to reset.
            HS4 Pro, 4.2.19.16 Windows 10 pro, Supermicro LP Xeon

            Comment


              #7
              Originally posted by rprade View Post
              I have dozens of counters in my system and have never had a problem controlling them, including reset.
              Whew! Thank you. It's nice to know that it should work.

              Just that it's so discouraging when, on your first try at something new, it doesn't work.

              Now, I just have to figure out what's wrong. Am I doing something wrong?

              It shouldn't matter that I have a Zee S2, right? It uses the same code as on the bigger HomeTrollers, or a regular computer running Linux, right?

              Comment


                #8
                Originally posted by MichaelK View Post
                Whew! Thank you. It's nice to know that it should work.

                Just that it's so discouraging when, on your first try at something new, it doesn't work.

                Now, I just have to figure out what's wrong. Am I doing something wrong?

                It shouldn't matter that I have a Zee S2, right? It uses the same code as on the bigger HomeTrollers, or a regular computer running Linux, right?
                Your event should work. Are you sure the event is running? I use similar events to count motion triggers for our bathroom fans but I use "IF the counter exceeds...". Is there any chance that the counter is stepping so fast as to miss 2? I use "exceeds" just to make sure that any value greater than 5 will trigger the event. Just for grins, change your trigger and see if the event works.

                Click image for larger version

Name:	Capture.jpg
Views:	1
Size:	32.5 KB
ID:	1192365

                I haven't a clue why yours isn't. If you are certain it is running and not resetting the counter, my approach would be to use an immediate script to write the counter value to the log, put a 2 second wait after the counter reset action, then write the counter value to the log again. This will help you know whether the event is running and what it is doing to the counter.

                If you need guidance on how to write log entries from an event, I or someone else can help.
                HS4 Pro, 4.2.19.16 Windows 10 pro, Supermicro LP Xeon

                Comment


                  #9
                  Originally posted by rprade View Post
                  Your event should work. Are you sure the event is running? I use similar events to count motion triggers for our bathroom fans but I use "IF the counter exceeds...". Is there any chance that the counter is stepping so fast as to miss 2? I use "exceeds" just to make sure that any value greater than 5 will trigger the event. Just for grins, change your trigger and see if the event works.
                  I'm definite that the event runs properly. I stated in the first post: "The other 'Then' entries work properly."
                  Furthermore, on the Home page (that lists all of the devices); the counter begins at 0 -- I step on the floorswitch and the counter goes to 1 -- I step on it again and it goes to 2. But then, it just stays there. If I step on it again, it goes to 3.

                  I have 1 more idea to try, when I get back to it.

                  Comment


                    #10
                    As I said above, your event should work. The thing that is perplexing is that you say it works when you click the "Run" button. I've never seen an event behave differently when executed by the "Run" button in the Event Manager than when run by its trigger, unless there are conditions. Your event doesn't have conditions.

                    I would first want to see trace log entries from the event just before and just after the counter reset action to verify the event is running completely as well as to record the counter values.

                    Since I use the same logic as you in many events and they execute properly and reliably, it is safe to assume there is something different between the two systems. The remote possibility that it is some sort of corruption in the database is likely proven false when you create a new counter and it exhibits the same behavior. If it was event corruption in the database, it seems it would behave the same whether triggered internally or run externally. This will be interesting to figure out. One other thing that could be tried is to disable this event, create a new event with a new counter on the off chance that it is still database related. If the new one doesn't work then I would probably test it with a blank database.
                    HS4 Pro, 4.2.19.16 Windows 10 pro, Supermicro LP Xeon

                    Comment

                    Working...
                    X