I have this problem where if a device has been improperly powered off, the MQTT status will still appear as On because the esp8266 is not able to send back any telemetry. I currently have a separate script which monitor the devices so that it will inform Home Assistant to switch it off once the device is disconnected.
I wonder if anyone did this purely within Home-Assistant? For example making a timer script that will reset every time it receive a MQTT telemetry and will turn off the device if it time out?