I’ve struggled with insomnia my whole adult life and I can tell you the three factors that have helped the most are, in order:
- removing caffeine completely
- getting enough direct sunlight (hours per day)
- losing weight
Everything else (melatonin, blue light, exercise, sleepy tea, other drugs, etc) never helped or made my quality of life worse.