If you're in a solid red or blue state with absolutely zero chance of flipping, then I think it's valid as a protest vote.
People have made this argument and while I see the logic behind it, I don't buy it.
I think especially this year it will be important to register a vote specifically against Trump, which means voting for the nominee. Yeah, maybe your state always votes 60-40 Democrat and it won't make a practical difference, but every vote gets added to the popular vote total. Writing in Mickey Mouse makes no dent in Trump's popular vote lead (or more likely, deficit). If he somehow manages to win again, I think it's crucial to at least take that talking point away from him - you do not represent the people. If nothing else it'll harden opposition to the Electoral College.
Also the degree to which some states are "safe" can easily be jeopardized. A few months before the last election I might have said Minnesota, Wisconsin and Michigan would all vote blue. I know people who refused to vote, or wrote in Bernie, or what-have-you and wouldn't you know it, Clinton won Minnesota by a terribly close-for-comfort margin. She lost the other two. The whole idea behind her election chances was the existence of "the blue wall," the states that have voted Democratic since 1992, and it came crumbling down. Hell, that's probably why she picked Kaine - it was considered more valuable to get a boost in Virginia (which had only voted blue twice since 1964) than to do anything for her in WI/MI/PA which were considered locks. Those states flipping was partly due to increased Trump support of course, but also significantly due to decreased Democratic turnout (look at Wisconsin - Trump actually got about 2,000 less votes there than Romney, but Clinton shed nearly 240,000 votes compared to Obama).
Point is, don't fucking risk it, and stay on the right side of history.