Circuit diagram for automation using RaspberryPi 3,Esp8266 and Openhab 2

Can anyone provide circuit diagram for home automation using Raspberry Pi ,Esp8266 and interfacing hardware with Openhab2!! I need code for Esp8266! Please help me out! Thank you!!

this is not quite the right forum for this;
just google around, there are a few sources available, but it all depends on your needs, here just two examples for some more popular applications that use the hardware and software you are mentioning:

there are others too, that use a GPIO connection between the raspberry and ESP8266, you will find them easily on the internet