Controlling distributed energy resources via deep reinforcement learning for load flexibility and energy efficiency