I'm afraid that when the device is turned off, the TCP connection used by the SSH session is not properly closed (or it's actually not closed at all) and the TCP/IP stack at the client machine is not even aware of this until the SSH component tries communicating with the device (which happens when some characters are typed).
To be able to detect this kind of unclean shutdowns, you would have to be somehow "pinging" the device continuously. But it would still take 20 seconds to detect this (it looks like it takes this long for the TCP/IP stack to realize the connection is broken). If you would still like to give this a try, please let us know at email@example.com.
Please be aware that I'm only guessing - a communication log produced using a network protocol analyzer such as Wireshark that can show the communication at the TCP level would be needed to confirm this.