WiFi Gateway on raspberry

Hi,
I saw the ESP8266 wifi gateway and i was wondering if i can use the on board wifi of raspberry as a wifi gateway. I have a new Sonoff wifi switch and i would like to control it through home assistant in raspberry if it is possible.
Thank you.

I think i am little confused. I just want to control my wifi Sonoff switch with my homeassistant. I saw these instructions https://www.mysensors.org/build/sonoff
where i can reprogramm the Sonoff ESP but i dont understand how it will communicate with homeassistant. Do i need also a separate wifi gateway or the Sonoff switch will be able to communicate with my controller through my LAN?
Thank you for your time to answer me.

@badisensors thanks for explaining. I am not familiar with Sonoff but according to the build page the sonoff will be its own gateway and communicate with Home Assistant using mqtt. There is no beed for a separate gateway.