From: Bernhard Tittelbach Date: Sun, 15 Dec 2013 02:38:04 +0000 (+0000) Subject: fix presence bug X-Git-Url: https://git.realraum.at/?a=commitdiff_plain;h=f5a1e37129017a529dcae55cb4d2b9b407bfa863;p=svn42.git fix presence bug --- diff --git a/go/r3-eventbroker_zmq/presence.go b/go/r3-eventbroker_zmq/presence.go index 94f48d7..87ae2f0 100644 --- a/go/r3-eventbroker_zmq/presence.go +++ b/go/r3-eventbroker_zmq/presence.go @@ -32,7 +32,7 @@ func MetaEventRoutine_Presence(ps *pubsub.PubSub, movement_timeout, button_timeo last_event_indicating_presence = evnt.Ts } else { if last_presence { Syslog_.Printf("Presence: Mhh, SomethingReallyIsMoving{%+v} received but presence still true. Quite still a bunch we have here.", evnt) } - if front_locked && front_shut && back_shut && evnt.Confidence >= 90 && last_event_indicating_presence > 1800 { + if front_locked && front_shut && back_shut && evnt.Confidence >= 90 && last_event_indicating_presence > 1800 && (last_door_cmd == nil || (last_door_cmd.Using != "Button" && last_door_cmd.Ts >= last_manual_lockhandling )){ new_presence = false } } @@ -68,6 +68,7 @@ func MetaEventRoutine_Presence(ps *pubsub.PubSub, movement_timeout, button_timeo } else if any_door_unlocked || any_door_ajar { new_presence = true } else if last_door_cmd != nil && (last_door_cmd.Using == "Button" || last_door_cmd.Ts < last_manual_lockhandling) { + // if last_door_cmd is set then: if either door was closed using Button or if time of manual lock movement is greater (newer) than timestamp of last_door_cmd new_presence = true } else { new_presence = false @@ -76,6 +77,7 @@ func MetaEventRoutine_Presence(ps *pubsub.PubSub, movement_timeout, button_timeo if new_presence != last_presence { last_presence = new_presence ps.Pub(r3events.PresenceUpdate{new_presence, ts} , "presence") + Syslog_.Printf("Presence: %t", new_presence) } } } \ No newline at end of file