Integration with energy storage