Lukáš Mešťan

Software engineer with a background in full-stack Web development & Open Source Enthusiast.

How to controll Philips TV via command line

- 2 mins

I wrote a bash script providing a bunch of functions to control your TV based on most common scripting language easily from command line. If you own a 2016/2017/2018 model (xxPFL5xx6 to xxPFL9xx6 or xxPUSxxxx), you can now use HTTP JSON queries to do more with the TV. I have model Philips 49PUS7181 which I tested it on.

This script provides a rich set of functions allowing to control your Android TV. Basicly it uses HTTP API to send commands to the TV. I use it to switch on/off the TV, select channels etc.

First, you need to know your IP tv.

How to find my Philips TV IP?

Check the Network settings on the TV. Press the “Home”-button on the remote control of the television and select: [Setup] > [Network settings] > [View network settings]

or press “Settings” on the remote control of the TV and select: [All settings] > [Wireless and networks] > [Wired or WiFi] > [View network settings]

philips tv

In this menu the following settings you can see [IP Address]. The IP address should not start with numbers 0 or or be empty.

How can I run the script?

You need to export _TV_IP variable for the script. For example export _TV_IP="192.168.x.x".

Interactive mode:

export _TV_IP="192.168.x.x" && ./ 

When the command is executed for a first time, the script automatically asks for a PIN (one time initialization):

pair code

after that, you can execute commands

tv commands

Non-interactive mode (direct execution):

export _TV_IP="192.168.x.x" && ./ <optional-command-to-execute-directly>

Possible arguments:

Custom command:

You can set variable _TV_COMMAND for send custom command (it will affect: “Send GET command” and “Send POST command” )

export _TV_IP="192.168.x.x" && export _TV_COMMAND="ambilight/topology" && ./ getCommand


Installation on Unix like OS

git clone && cd philips-tv
sudo make install

For uninstalling, open up the cloned directory and run sudo make uninstall. For update/reinstall sudo make reinstall

System requirements

Unix like OS with a proper shell, openssl ; curl ; base64 ; awk ; sed ; tr ; echo ; grep ; cut ; sort ; head ; fold ; uniq ; column. Dependences jq (apt install jq)