Yes and Yes.
Actually there is no right answer to this question. I'm sure the adventure of writing a technical book is well worth undertaking just for the experience if and only if that is the sort of thing you are interested in. I'm sure for someone who's never endeavored to be a writer it would be a nightmare.
Likewise, writing blogs and such disseminates knowledge in a way that writing a book doesn't. Blogs are immediate and interactive. Book are snapshots of the past. Both have value and both, again, are worthy ways to spend your time.
Notice I have discussed finance or subject matter. They aren't really important. You are already aware that you won't become rich and as the subject matter whether it is a niche or a well-mined subject a new book can't hurt. Another beginners C++ book isn't needed but maybe the next one will be the best one. Can't tell unless someone writes a next one. Likewise a niche book (embedded toaster oven programming) probably isn't worth the time unless you have a passion for it.
Ultimately, you really need to decide if you can devote yourself to the 3, 6, maybe 12 months being fully absorbed in writing/tuning/editing the book or not.