...The service assumes that if Wi-Fi data transfer rate is less than 64KiB per minute for 15 minutes in a row then there's no application that actively uses Wi-Fi.
Also this app can turn Wi-Fi off if there's no signal for 1 minute.
Google Play page:
https://play.google.com/store/apps/details?id=net.alkatrazstudio.wifiidletimeout