A simple REST API to modern Samsung TVs based on a Websocket connection. I can't promise that this works on all TVs, I built this based on a bit of research and testing what method works well with my own TV.
See the API documentation on GitHub pages. The API of the server is defined by the api/server.yml
Swagger specification.
/status
: to the get connection status/power/<on|off>
: turns the TV on or off/key/POWER
: to turn the TV on or off; this is translated to aKEY_POWER
key event
A list of KEYs that I tested with my TV:
- POWER
- MENU
- HOME
- SOURCE
The configs/config-template.yml
offers a template for the service configuration.
Make sure you that
- you have
dep
installed. Visit https://github.com/golang/dep - your
GOPATH
andGOROOT
environments are set properly.
There is a Makefile
provided that offers a number of targets for preparing, building and running the service. To build and run the service against the configs/test.yml
configuration, simply call the run
target:
make clean run
I currently have a very basic systemd unit file defined under init/api-samsungtv.service
. This can be later improved.
Before using the service definition, make sure that you go through the file and update the WorkingDirectory
and ExecStart
to match your installation.
The code is published under an MIT license.
Please report issues or feature requests using Github issues. Code contributions can be done using pull requests.