This is the one thing where a HOA or a similar Co-op might be useful.

Everyone has panels on their roofs and they own a shared grid-scale battery that they feed into.