Hi,
I have developed a custom Sensor Entity for Heatmiser Wifi thermostats (heatmiser_wifi_ha). Sometimes the Wifi thermostat gets offline of different reasons (network issues etc.). This currently results in an exception when update() is called in climate.py and Home Assistant will simply stop talking with my Sensor Entity and mark it as unavailable. climate.py is robust enough to allow update() to be called again after the thermostat is available, but Home Assistant stops all contact with climate.py after the exception. The only way to recover is to restart Home Assistant.
Is there any best practice in how to handle device offline issues when developing custom Sensor Entities? I don’t find any information on the developer pages. Is there any specific return value or Exception from update() I could use to mark the sensor as temporary offline?
I could off course just ignore to send the exception but then I will not notice that the sensor is offline in Home Assistant.
Best regards,
Joel