Component destructor

Hello !

I’m want to patch the Decora component to improve stability.
I need to run the disconnect function when I stop the Home assistant deamon.
Is there any destructo funciton that I can call in the component when the Home assistant shuting down ? (the opposite of setup_platform…)

Thanks !

hass.bus.listen_once(EVENT_HOMEASSISTANT_STOP, _shutdown)

Where _shutdown is your custom function

Thanks ! This is perfect !

1 Like