it is actually simpler. The inverter stops power flow if it does not detect a grid voltage.
The actual power coming from a balcony setup is tiny, a thousand watts ballpark. The typical house will consume the vast majority of that capacity.
Even if some flows back to the grid, it will likely be consumed by losses in the transformer and wires.