Hello to you all.
I am using OpenHab some years now and I am having great success.
The one thing I struggle a little bit is presence. The way I have set it up now is:
When a physical button is pressed (to open a light of a fan or whatever) or a PIR sensor is activated the presence is set to ON and with the expire binding set to 20mins. Even the pets do not set off the PIRs since they are high on and detect only human movement. Anyway It works exactly as planed except at night. At night there are times that we donât move for enough time so the PIRs wonât catch a movement and presence will then be set to OFF after 20 mins. It happens 1-2 times every night
So, my Idea is as follows.
Tie the presence detection with the doors opening and closing.
Example 1: Door opens and then closes, person comes in and PIR sensors trigger so ->Presence is set to ON
Example 2: Door opens and then closes, and presence is already set to ON but for the next 5 min no PIRs or physical button fire up, so we deduce that the person has left and thus set presence OFF
Example 3: Presence is ON but there is no movement detected for the last 20 minutes. Also no doors opened in that time frame so no one could have left the house, so we deduce that they are standing still or sleeping so we leave presence set to ON until time comes that a door opens again.
Any idea how to implement this in rules?
Hopefully, all this makes sense.
Switch Presence "Someone is Present" <present> { expire="30m,command=OFF" }// master presence switch, represents to the rest of OH where someone is home
Group:Switch:AND(OFF,ON) gPresence_Sensors <present> // all presence sensors belong to this group
rule "Presence detect"
when
Member of gPresence_Sensors changed
then
var numberOfPresses = triggeringItem.state.toString()
switch(numberOfPresses) {
case "NULL": {return;}
case "HOLD": {Presence.sendCommand(ON)}
case "SINGLE": {Presence.sendCommand(ON)}
case "DOUBLE": {Presence.sendCommand(ON)}
case "TRIPLE": {Presence.sendCommand(ON)}
case "QUAD": {Presence.sendCommand(ON)}
case "PENTA": {Presence.sendCommand(ON)}
case "OPEN": {Presence.sendCommand(ON)}
case "ON": {Presence.sendCommand(ON)}
default :{ }
}
end
If you put the time of day Design pattern in to the mix you can use a rule to trigger the presence switch during the day and a different rule during the night The rule in the night can have an timer build in to switch the presence to ON again after X minutes. Or maybe assume that somebody is present during the night if the presence switch has been ON during 1 hour before standard bed time (only during the week).
âWasp in a boxâ is a standard name for the technique you independently thought up. Iâm afraid you re-invented a wheel without knowing it was called âwheelâ
There are some caveats, I live alone in a third floor flat. There is only one entry and exit unless you are spiderman. Most households have several entry points, some have dozens. Also, I live alone, multiple people coming and going makes things a lot more complicated. Sure fire presence detection is not easy.
My rule example was truly meant to be a very high level example and an introduction to the concept of the âwaspâ
And there in lies the great practical advice for presence detection. I was attempting to use, primarily, the door contact and a motion sensor to distinguish presence but also adding in my phone logging on to the wifi as a secondary way to reassure the decision making. The âweightâ you give each different method allows you to make a better decision and will need tweaked for your given situation. And the more different methods used, the more reliable the decision making.
There are a lot of options⊠beam break sensors, ultrasonic sensors, video with facial recognitionâŠ