“Trial and error”-ed…
For Sonoff just search for it. There is a long topic about how to flash them and what DH and SmartApp to use. But here you go: