The Cookie Machine - Click here to drag window

DUMMY TEXT - Real text set in assets/js/theCookieMachine.js

Views: 3,541β€…    Votes:  4β€…
Tags: software-recommendation   samsung   remote   smart-tv   yad  
Link: πŸ” See Original Answer on Ask Ubuntu πŸ”—

URL: https://askubuntu.com/q/1148133
Title: GUI application for controlling Samsung Smart TV connected to the same LAN of ubuntu desktop
ID: /2019/06/02/GUI-application-for-controlling-Samsung-Smart-TV-connected-to-the-same-LAN-of-ubuntu-desktop
Created: June 2, 2019    Edited:  June 4, 2019
Upload: November 24, 2022    Layout:  post
TOC: false    Navigation:  false    Copy to clipboard:  false


You can use YAD to create GUI front end to CLI commands.

As a comment points out there is a CLI controller for the Samsung Smart TV:

You just need to install Yad with sudo apt install yad and create a GUI window like this:

yad remote control

Using this command:

yad --title "Remote Control" --text "Samsung Smart TV" --width 250 --height 400 --form --columns 2 --field "Power:FBTN"  --field "Vol +:FBTN" --field "Vol -:FBTN" --field "Input:FBTN"  --field "Chan +:FBTN" --field "Chan -:FBTN"

Additional code is required to link each button to the Samsung Control program:

samsungctl --host <host> [options] <key> [key ...]

If I had a Samsung Smart TV I would enjoy writing the full script. However my Smart TVs are Sony and Toshiba. I will try to write a remote control GUI script soon for those TVs.


Seeing it in action

I created a little demo where instead of calling the Samsung Smart TV commands are echoed to the screen.

yad TV remote controller.gif

The one-liner code is a little longer now:

yad --title "Remote Control" --text "Samsung Smart TV" --width 250 --height 400 --form --columns 2 --field "Power:FBTN" 'bash -c "echo Power"'  --field "Vol +:FBTN" 'bash -c "echo Volume Up"' --field "Vol -":FBTN 'bash -c "echo Volume Down"' --field "Input:FBTN" "bash -c 'echo "Input"'"  --field "Chan +:FBTN" 'echo "Channel up"' --field "Chan -:FBTN" 'bash -c "echo Channel Down"'

As mentioned in comments if you have a Samsung TV newer than 2016 you will also need to download the websocket-client

⇧ How to enable NVIDIA? What does shellcheck warning SC2129 β€œConsider using { cmd1; cmd2; } >> file instead of individual redirects.” mean?  β‡©