How to bring D-Link DSP-W118 out of cloud into HA?

I’ve recently bought one of those cheap W118 Wifi switches. Using their cloud works fine, but i’m more interested having full control over the device myself.
Is there a way to flash the ESP8266 inside with a new firmware which will offer me to assign it to my home Wifi in a way HA can access it?

There is an integration for D-Link devices like W110, which seems very similar to the W118

For other devices there is a need to a login, but i have no clue where to get this. The above integration works by login to the device using an exposed API. I will check if the plug has any ports open, maybe most of the code could be reused?