Comedy may not be your genre, but it's still important to add a little humor to your writing. It gives characters dimension, it breaks up tension (especially in dramas), but most of all, it gives your readers an extra layer of entertainment.
Just like real people, characters have many sides to their personalities. Even the most complex personalities still have a funny side, even if it's not as prevalent. For example, in my Hernandez series, my protagonist Jorge can be described as intimidating, powerful, intense, and dangerous. Then out of nowhere, he'll make a sarcastic remark or comment that will make readers laugh. It may not be the top quality he's known for, but it's still thrown in from time to time to add a little extra flavor.
In general, humor is needed from time to time, especially if the particular story is very emotional or heavy. I know it may seem inappropriate in those situations, but again, just like in real life, we sometimes need a break when wading through difficult emotions. For example, if you're watching a movie where a character is dying, it can become very intense for the viewer to watch for a long time. However, if a child were to make an innocent (yet funny) remark or observation, it might break things up a bit for the viewer.
Comedy in writing shouldn't feel forced or overthought. Often if you follow the character's natural inclinations and personality, the humor comes out naturally and shows us their lighter side.