From 5af06899baaaf2c7f375bab319e6e13b7225c8fc Mon Sep 17 00:00:00 2001 From: Bernhard Tittelbach Date: Thu, 17 Oct 2013 01:54:34 +0000 Subject: [PATCH] zu schnell commitet --- go/r3-eventbroker_zmq/presence.go | 3 ++- go/r3-eventbroker_zmq/sockettoevent.go | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/go/r3-eventbroker_zmq/presence.go b/go/r3-eventbroker_zmq/presence.go index dd2b5f6..cf58e5d 100644 --- a/go/r3-eventbroker_zmq/presence.go +++ b/go/r3-eventbroker_zmq/presence.go @@ -43,6 +43,7 @@ func MetaEventRoutine_Presence(ps *pubsub.PubSub, movement_timeout, button_timeo last_door_cmd = &evnt case r3events.DoorManualMovementEvent: last_manual_lockhandling = evnt.Ts + last_event_indicating_presence = evnt.Ts case r3events.DoorLockUpdate: front_locked = evnt.Locked last_frontlock_use = evnt.Ts @@ -66,7 +67,7 @@ func MetaEventRoutine_Presence(ps *pubsub.PubSub, movement_timeout, button_timeo //... skip state check .. we had a definite presence event } else if any_door_unlocked || any_door_ajar { new_presence = true - } else if last_door_cmd.Using == "Button" || last_door_cmd.Ts < last_manual_lockhandling { + } else if last_door_cmd != nil && (last_door_cmd.Using == "Button" || last_door_cmd.Ts < last_manual_lockhandling) { new_presence = true } else { new_presence = false diff --git a/go/r3-eventbroker_zmq/sockettoevent.go b/go/r3-eventbroker_zmq/sockettoevent.go index a57eaee..7831ab8 100644 --- a/go/r3-eventbroker_zmq/sockettoevent.go +++ b/go/r3-eventbroker_zmq/sockettoevent.go @@ -33,6 +33,7 @@ func parseSocketInputLine_State(lines [][]byte, ps *pubsub.PubSub, ts int64) { case "opened": ps.Pub(r3events.DoorLockUpdate{false, ts}, "door") case "manual", "manual_movement": //movement + ps.Pub(r3events.DoorManualMovementEvent{ts}, "door") case "error": ps.Pub(r3events.DoorProblemEvent{100, ts}, "door") case "reset": -- 1.7.10.4