Announcement

Collapse
No announcement yet.

How to create a occupancy status script

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

    How to create a occupancy status script

    Hey again.

    I would like to know if it is possible to have the home or away virtual device i have create to toggle just by the garage door and main gate.

    Ex. when i leave the house i always have the garage open for about a minute before i open the main gate and i would like the status to go to away.

    then when i come home, i open the gate and then the garage, and have it change back to home status.

    Is there a simple way to do this.? cause the way i have it setup now in the events page it just toggles back and forth and stops randomly as it pleases.

    I hope someone can help me out here..

    I have zero scripting skills. so please bear that in mind..

    Yhx

    Yvo

    #2
    A lot depends on how consistent you are and whether there are other circumstances when similar sequences occur, but assuming the conditions you describe are accurate and unique, then I think you could do what you want with events.

    In one event you trigger on the gate opening with the condition that the garage door has been open for at least x seconds, (and possibly for less than y minutes). The action would be to set the device to 'Away'.

    In another event you trigger on the garage opening with a condition that the gate has been open for less than z seconds. The action would be to set the device to 'Home'.
    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
      Hey Uncle,

      Thank you for helping work through this problem.

      But i already have it setup that way. The problem is that i need to be to so that if first the garage is opened and then the gate it would go to away mode.

      And vice versa on the other way around.

      The gate will be open the same amount of time for entering or exiting.

      So i guess it would need to be a bit more complex then that.
      And i am not good at that at all..

      I soooo wish i knew how to code. I bet i could make my house dance..

      So i hope you can still help me out with more complex programming..

      Thx

      Yvo

      Comment


        #4
        Use a virtual device to monitor the door ans anouther for the gate and use or ifs
        sigpic
        A founder member of "The HA Pioneer Group" otherwise known as the "Old farts club!"

        Comment


          #5
          I would look at using timers with events rather than a script. Start a timer when the door opens and then if the gate opens within a certain amount of time, then set the away status and stop/reset the timer. Do something similar for coming home.

          Cheers
          Al
          HS 4.2.8.0: 2134 Devices 1252 Events
          Z-Wave 3.0.10.0: 133 Nodes on one Z-Net

          Comment


            #6
            Originally posted by Positivo View Post
            But i already have it setup that way. The problem is that i need to be to so that if first the garage is opened and then the gate it would go to away mode. And vice versa on the other way around.
            You've left me confused.

            If you have an event that triggers on the gate opening with the condition that the garage door is open, doesn't that imply that the garage door opened first?

            Is the garage door already closed before the gate opens? If so, then I'd second Al's suggestion that a timer for how long since the garage door status last changed might do what you want. And vice versa.
            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
              Not sure if it would be appropriate in your case but along with a few other parameters I do occupancy like this.

              In simple form:
              All external doors have open / closed sensors and all internal rooms have motion sensors.

              I have a virtual "occupied" device and if any "external" sensor becomes closed and the virtual device is "occupied" then I start a timer. If that timer gets to 10 minutes then it is stopped, reset and the virtual device is set to "unoccupied".

              If any internal sensor becomes "motion" the timer is stopped, reset and the virtual device is set to "occupied".

              Its not entirely foolproof because in a situation where someone leaves home and others remain in the house but not moving (in bed perhaps) then it would falsely set "unoccupied". This is where I use various other parameters to determine if anyone is still at home.

              Another situation where it wouldn't work is if you leave pets inside the house unless your motion sensors are pet immune.

              Paul..

              Comment


                #8
                Hey Guys..

                This is what i have had so far. And it just seems to keep running both or just one when ever it feels like.

                Please have a look and let me know what has been going wrong where.
                Attached Files

                Comment


                  #9
                  The first event should work ok, but you would need to change the order of the second one that if the garage door changes and becomes open and if the gate has been open for x number of seconds, it would set it to home.

                  Cheers
                  Al
                  HS 4.2.8.0: 2134 Devices 1252 Events
                  Z-Wave 3.0.10.0: 133 Nodes on one Z-Net

                  Comment


                    #10
                    the reason it was not right, is cause i have been trying everything back and forth. just looking to see which works best.

                    But it is the way i show below, but still pretty random, and sometimes no change at all..

                    So all i can think of is a sort of script that checks which one is triggered first and set the status like that.

                    I can think of no other way. Besides, i saw a system in this forum, that work with some sort of radio device that can track keyfobs. Even when in the house in knows what room you in. Any idea on that..??

                    Yvo
                    Attached Files

                    Comment


                      #11
                      Originally posted by Positivo View Post
                      But it is the way i show below, but still pretty random, and sometimes no change at all..
                      That's a puzzle. The events look like they ought to do what you want. Can you post some examples from the HS log that capture times when the result was not what you expected?
                      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


                        #12
                        What you want to know is the direction of the movement to determine the home or away status.

                        Maybe it will work like this
                        Make a virtual device (VD) and control its value

                        * If Door opens -> is VD = 0 then VD = 10
                        * If Door opens -> is VD = 20 then set mode HOME

                        * If Gate opens -> is VD = 0 then VD = 20
                        * If Gate opens -> is VD = 10 then set mode AWAY

                        * If VD <> 0 for atleast 30 sec -> set VD = 0
                        - Bram

                        Send from my Commodore VIC-20

                        Ashai_Rey____________________________________________________________ ________________
                        HS3 Pro 3.0.0.534
                        PIugins: ZMC audio | ZMC VR | ZMC IR | ZMC NDS | RFXcom | AZ scripts | Jon00 Scripts | BLBackup | FritzBox | Z-Wave | mcsMQTT | AK Ikea

                        Comment

                        Working...
                        X