zu schnell commitet
authorBernhard Tittelbach <xro@realraum.at>
Thu, 17 Oct 2013 01:54:34 +0000 (01:54 +0000)
committerBernhard Tittelbach <xro@realraum.at>
Thu, 17 Oct 2013 01:54:34 +0000 (01:54 +0000)
go/r3-eventbroker_zmq/presence.go
go/r3-eventbroker_zmq/sockettoevent.go

index dd2b5f6..cf58e5d 100644 (file)
@@ -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
index a57eaee..7831ab8 100644 (file)
@@ -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":