Could be masking an underlying problem. Maybe you have to ask yourself why you're using codeine & weed and address this? Depression, anxiety, boredom? In my opinion it sounds like you've already identified the need for a change. Is there something else you can devote your time to that will keep you sober? Hitting the gym, learning a martial art, language or instrument, playing a sport? Exercise is amazing for lifting your mood but something that keeps you mentally stimulated could be just as effective?
The good news is you won't suffer terrible withdrawals from either substance compared to say a benzo, alcohol or stronger opiate addiction; if you have the determination you should be able to get off both without additional meds.