Is it possible to controll a Sonoff basic smart switch with an ESP32 over Wi-Fi?

So I know these switches use ESP8266 and they can be reprogrammed. The thing I don't know if it is possible to make a WiFi communication between this chip and an ESP32. I haven't really worked with ESPs before, only Arduinos with Atmega.

The main idea is that the ESP32 has a touchscreen and from there I would be able to turn on-of the Sonoff switch. There would be more ESP8266 devices in the network if it is possible.

Flash the Sonoff's with Tasmota firmware, then you can use the MQTT protocol to control either or future switches.

Also, consider looking at Home Assistant.