If you're looking to dive deeper: check the (local REST + MQTT) or the Tasmota/ESPHome repositories for the Plus 2PM template.
The is a popular Wi-Fi-enabled, two-channel smart relay with power measurement, and its firmware is indeed an interesting piece of technology—both for its official capabilities and the community-driven modifications. shelly plus 2pm firmware