A home battery setup can be optimized for multiple energy sources through a smart energy management system. This system can prioritize the use of renewable energy when available, switch to grid power when it is more economical, and even store excess energy for use during peak demand times.