Announcement

Collapse
No announcement yet.

How to check if a counter is less than zero

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

    How to check if a counter is less than zero

    I have seen a few threads on this topic but I didn't see any conclusive answer.

    I have a counter that tracks when people enter and leave the house via Life360, for person A I increment and decrement by 1, for Person B I increment and decrement by 10, and so on.

    I want to have a failsafe in case the counter drops below zero where I recalibrate the people in the house.

    Does anyone have any ideas on how to check if counter is less than zero.

    (sometime Life 360 doesn't always report people arriving correctly)

    #2
    Originally posted by NC-Lou View Post
    I have seen a few threads on this topic but I didn't see any conclusive answer.

    I have a counter that tracks when people enter and leave the house via Life360, for person A I increment and decrement by 1, for Person B I increment and decrement by 10, and so on.

    I want to have a failsafe in case the counter drops below zero where I recalibrate the people in the house.

    Does anyone have any ideas on how to check if counter is less than zero.

    (sometime Life 360 doesn't always report people arriving correctly)
    There is no Trigger available for a counter less than 0. If you can “recalibrate” the people in the house, why not run a recurring Event that performs this recalibration, regardless of the count. You could compare the recalibration value with the current people count and only update if it would result in a new value.

    HS4 Pro, 4.2.18.3 Windows 10 pro, Supermicro LP Xeon

    Comment


      #3
      I have something similar when a counter exceeds and notifies me.

      Would an event work with trigger "This Device Had its Value Set and is Less Than 0" work for you?

      Comment


        #4
        Originally posted by will40 View Post
        I have something similar when a counter exceeds and notifies me.

        Would an event work with trigger "This Device Had its Value Set and is Less Than 0" work for you?
        That will only work if he has chosen to create HomeSeer Devices for counters and timers.

        Click image for larger version

Name:	BAAA101E-BFE5-4CFF-8381-919BF7D40E76.jpg
Views:	76
Size:	89.1 KB
ID:	1591705

        I prefer not creating HomeSeer Devices due to the overhead timers can have. You can Enable them temporarily until the devices are created, then disable in settings and delete the HS devices for counters and timers for which you don’t need.
        HS4 Pro, 4.2.18.3 Windows 10 pro, Supermicro LP Xeon

        Comment


          #5
          gotcha...I have very few counters using them for house maintenance and they do not trigger very often but I will keep that in mind if I notice any system performance issues.

          Comment


            #6
            Actually, I am am just going to flip the increment and decrment. Then I can have two checks, one if the counter is greater than zero, and one if the absolute value is greater that 1111111.

            Thanks for the suggestions, it help me think.

            Comment


              #7
              Counters are not a drag, but timers updating every second when running can have an impact. I have about 50 timers with 10-20 running. I don’t need all of them as HS devices.
              HS4 Pro, 4.2.18.3 Windows 10 pro, Supermicro LP Xeon

              Comment


                #8
                NC-Lou

                Just check if the counter value = -1
                if it does then Reset the counter

                RDP

                Comment


                  #9
                  NC-Lou

                  Was just checking, but depending on which version you are using you could also check for a multiple of -1

                  ​​ Click image for larger version

Name:	image.png
Views:	39
Size:	33.5 KB
ID:	1595505

                  Hope it helps,

                  RDP

                  Comment


                    #10
                    randy

                    Originally posted by randy View Post
                    That will only work if he has chosen to create HomeSeer Devices for counters and timers.
                    I didn't think it would work with counters like that. They are greyed out in the list of devices.

                    Did I miss something?


                    Thanks!
                    Roger

                    Comment


                      #11
                      Originally posted by Roger D View Post
                      randy



                      I didn't think it would work with counters like that. They are greyed out in the list of devices.

                      Did I miss something?


                      Thanks!
                      Roger
                      You are correct. I believe used the HS Device counter values as a trigger under HS3, but that has been 7 or so years ago. They are not available as triggers now.
                      HS4 Pro, 4.2.18.3 Windows 10 pro, Supermicro LP Xeon

                      Comment


                        #12
                        Originally posted by Roger D View Post
                        NC-Lou

                        Was just checking, but depending on which version you are using you could also check for a multiple of -1

                        ​​ Click image for larger version

Name:	image.png
Views:	39
Size:	33.5 KB
ID:	1595505

                        Hope it helps,

                        RDP
                        This would work and is the functional equivalent of this counter was set and has a value less than 0. I never thought about that one.

                        HS4 Pro, 4.2.18.3 Windows 10 pro, Supermicro LP Xeon

                        Comment


                          #13
                          Thank you, I will try that.

                          Comment

                          Working...
                          X