Added special handling for lasttrip/tripped on contact sensors