this works by looking at the physical characteristics of the lens, so on or off should work regardless, you could have something with some kind of internal shutter to cover the lens maybe
For the typical indoor WiFi cameras without battery backup, a simple way to detect them could be to turn all breakers off and on, and listen for their motors rotating on startup. Or make the room dark and listen for the click of the IR cut filter switching to night mode or back.