From what I’ve seen, the main difficulty with Sonoff is that
we’ll need to get the Pi to connect to the WiFi network the Sonoff
device creates during its pairing process. Doing this is
incompatible with all the other pairing processes that would
normally take place at this time (e.g. the philips hue and tp-link
adapters both expect to be talking to their devices over
internet).
I think the most likely approach for now is to create a utility
which pairs the gateway with the sonoff independently so it doesn’t
mess with other devices.