Edge and fog computing using IoT for direct load optimization and control with flexibility services for citizen energy communities