When I have a grid outage, my tesla gateway2 switches to backup mode and runs from battery and solar, which is fine.
When the grid comes back, the system remains in backup mode. I dont know how long, because I loose my patience and turn the battery off and on, then the app shows the grid is back...