I use nodejs to control gpio on raspberry in combination with mqtt to communicate between openhab and the nodejs script
See alsoConnecting a conventional doorbell to openhab
This Tutorial is still with the mqtt 1 binding, last weekend converted my openhab setup to 2.5 (with mqtt 2 binding) but didn’t update the documentation