My first idea would be to use the Raspberry Pi as an infrared transmitter using LIRC and send the appropriate ON/OFF commands to the TV.
The second is that there are remote apps for cell phones. So there is also a Samsung TV network remote control protocol. This could also be used to control the TV. On Github, you can find some information about TCP/IP connections with “samsung remote”.