I think all Sonoff products should be equipped with WiFi, REST and MQTT.
WiFi + REST + MQTT
Motion sensor, window open.
This is the best combination for any home automation device.
Flashing with Tasmota provides that functionality. Although first one has to be able to upgrade to the most current Sonoff f/w, v3.3.0, which does not work for me when trying with a Mini.