Esp32 output on home assistant error

I’d like to have an esp32 fire an output itself if home assistant is off line does this exist already?

You could monitor any sensor from Home assistant Home Assistant Sensor — ESPHome

Then on_value “unavailable” do your action. Sensor Component — ESPHome