This page describes the basic work flow to add a new homematic hardware as a thing to openHAB. I use homegear as homematic server. There are also other possibilities but homegear is already part of the openhabianpi image and is in my opinion the easiest solution.
I describe here my work flow. As open openHAB is there are for sure many others. But the work flow described here was in the past very stable to use.
As precondition I assume that you have a raspberry pi with an openhabianpi image installed and you need a HM-MOD-RPI-PCB module installed. This ensures an wireless connection to your homematic hardware.
I explain the work flow by adding a new door/window contact HM-Sec-SCo.