What is the difference between 电视 and 电视上? In the following two sentences:

电视说今天很晴朗，不过下午下雨了。
电视上说今天的天气会很晴朗，今天一整天都很晴朗。


Why does the first sentence not use 上 but the second sentence does? Is there any difference between 电视 and 电视上?

I think the meaning is the same - i.e. both mean "The TV says..." or "According to the TV...".
Well, as a native speaker, I would say there is no rigid rule for the usage under consideration. Both sentences precisely express what you would like to express.

So yes, they are identical in meaning.