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
//... 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
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":