Fine tuning of wifi presence detection

I think I made it meanwhile thaks to your patience and support.
I verified the “Generic Example” step by step with this thread and found one switch missing as well as some naming problems. After resolving that it stated working. Your question actually was the main thing:

Right now it looks quite good, sensors are coming up and down, presense switch is turing on and off according to presence.
Thanks again
Marcus

that’s my setup works ! but any idea’s? if I missed something or else…

.Thing

Thing network:pingdevice:person1Phone "Person1 PresenceWifi" @ "Presence" [ hostname="xxx.xxx.xx.xxx", retry=1, timeout=5000, refreshInterval=60000 ]

.items

Switch Present_Timer { expire="1m,command=OFF" }

//need group if a person owns more than one device
Group:Switch:AND(OFF,ON) gperson1Present <present>
Switch person1_Present <present> // master person1 present switch
Switch person1_Present_Timer { expire="30m,command=OFF" }

Switch person1_iphone <network>  (gperson1Present) {channel="network:pingdevice:person1Phone:online"}

.rules

val String filename = "Presence.rules"

rule "start system"
when
    System started
then
    person1_Present.sendCommand(OFF) // assume no one is home   
end

rule "StateMainDoor updated and start main Timer"
when
    Item StateMainDoor received update // when Sensor main door gets updated
then
    Present_Timer.sendCommand(ON) // start main timer
end

//---------------------person1----------------------
rule "Trying to find person within timer window"
when
	Item person1_iphone changed from OFF to ON  or
    Item person1_iphone changed from NULL to ON or
    Item Present_Timer received command OFF      
then
    if(person1_Present.state == OFF) {
        if(person1_iphone.state == ON) { 
            person1_Present.sendCommand(ON) // set present ON for Person 1
            logInfo(filename, "person1 is Home!!! ") 
        } else if(person1_iphone.state == OFF) {
            person1_Present.sendCommand(ON) // set present ON for Person 1
            person1_Present_Timer.sendCommand(ON) //start timer for Person 1
            logInfo(filename, "Trying to find person1 (Timer 30Min is now ON)") 
        }
    }
end