SAMSUNGCTL

November 19, 2025 ยท View on GitHub

NO LONGER MAINTAINED

******* ALL USERS PLEASE READ *******

UPDATE TO POWER KEYS.. In order to remove confusion of what TV supports what power keys. I have decided to alter the Samsung handling of keys. The way Samsung had them set up seemed to cause to much confusion. I think that everyone will like this way better.

KEY_POWER = toggle. This is going to toggle the power. so if the TV is off it will turn it on. and if it is on it will turn it off.

KEY_POWERON = Discrete power on. this will always turn the TV on if it is off.

KEY_POWEROFF = You guessed it. Discrete power off. If the TV is on this will turn it off.

This is a much easier mechanism and a whole lot easier to grasp. so no matter what TV you have and what key it supports no longer matters. This is what these keys will do. plain and simple.

PLEASE READ

The library has be updated and added to. There is a plethora of new features as well as some changes to the old ones. Be sure to read this documentation in it's entirety.

If you ask a question and the answer is in this documentation the only thing I am going to say is Read the documentation.

So it is my suggestion that you do exactly that before posting any kind of an issue.



******* LEGACY TV OWNERS (TV's older then 2014) PLEASE READ *******

DO NOT POST AN ISSUE ABOUT THE TV NOT POWERING ON THE TV DOES NOT SUPPORT IT!!!!

SAMSUNGCTL

BIG NEWS!!!! samsungctl now supports the ever elusive H and J model year (2014 and 2015) TV's



I want to give a thanks to the people that helped in the bug testing of this version. It has been a bit of a challenge because of the different devices/OS's that samsungctl is running on. In no special order I want to say TY for the help. If I have missed someone please let me know.

  • @eclair4151
  • @fluxdigital
  • @DJPsycho82
  • @sebdbr
  • @Murph24
  • @davidgurr
  • @vitalets
  • @msvinth
  • @dcorsus
  • @xxKeoxx
  • @iAbadia
  • @raydog153
  • @andreas-bulling

Onto the library.

samsungctl is a library and a command line tool for remote controlling Samsung televisions via a TCP/IP connection. It currently supports 2008+ TVs with Ethernet or Wi-Fi connectivity. That includes the H and J model year TV's as well as the TV's that have the latest Samsung firmware that makes use of an SSL based websocket connection.

On all TV's you will be prompted to accept the connection this prompt gets displayed ON THE TV. You will have 30 seconds to do this before it errors out. There is a slight variation to this, on 2014 and 2015 year TV's (H and J) a pin will be displayed ON THE TV that will have to be entered when prompted to ON YOUR PC.

This program IS NOT the same one that is available on the Python Packaging Index (Pypi). I do not have access to that and unfortunately the original author Ape has been on hiatus for some time. He may no longer be maintaining the library.

So for the time being you will need to clone this repository and install it using the directions below.



Dependencies

  • Python 2.7+
  • websocket-client
  • requests
  • pycryptodome
  • lxml
  • ifaddr
  • six
  • curses (optional, for the interactive mode)



Installation

python setup.py install

It's possible to use the command line tool without installation:

python -m samsungctl



Command line usage

You can use samsungctl command to send keys to a TV:

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



host is the hostname or IP address of the TV. key is a key code, e.g. KEY_VOLDOWN. See Key codes.

There is also an interactive mode (ncurses) for sending the key presses:

samsungctl --host <host> [options] --interactive



Use samsungctl --help for more information about the command line arguments:

usage: samsungctl [-h] [--version] [-v] [-q] [-i] [--host HOST] [--port PORT]
                  [--method METHOD] [--name NAME] [--description DESC]
                  [--id ID] [--token TOKEN] [--timeout TIMEOUT]
                  [--volume VOLUME] [--mute MUTE] [--brightness BRIGHTNESS]
                  [--contrast CONTRAST] [--sharpness SHARPNESS]
                  [--source SOURCE] [--source-label SOURCE_LABEL]
                  [--config-file PATH/FILENAME]
                  [--start-app APP NAME OR ID] [--app-metadata METADATA]
                  [--key-help]
                  [key [key ...]]

Remote control Samsung televisions via TCP/IP connection

positional arguments:
  key                 keys to be sent (e.g. KEY_VOLDOWN)



Breakdown of the parameters:

optional argumentdescription
-h, --helpshow this help message and exit
--versionshow program's version number and exit
-v, --verboseincrease output verbosity
-q, --quietsuppress non-fatal output
-i, --interactiveinteractive control
--host HOSTTV hostname or IP address
--port PORTTV port number (TCP)
--method METHODConnection method (legacy or websocket)
--name NAMEremote control name
--description DESCremote control description
--id IDremote control id
--token TOKENAuthentication token that is used by 2014-2015 TVs and some 2016-current TVs
--timeout TIMEOUTsocket timeout in seconds (0 = no timeout)
--volume VOLUMEsets the volume allowed values: 0-100 or -1 to print the volume
--mute MUTEsets the mute. allowed values: on, off, state. state to print the mute state
--brightness BRIGHTNESSsets the brightness allowed values: 0-100 or -1 to print the brightness
--contrast CONTRASTsets the contrast allowed values: 0-100 or -1 to print the contrast
--sharpness SHARPNESSsets the sharpness allowed values: 0-100 or -1 to print the sharpness
--source SOURCEset the source. you can use the TV defined names.. HDMI1, HDMI2, PC, USB... or you can use the programmed label that appears on the OSD.
--source-label SOURCE_LABELsets the source label that appears on the OSD
--config-file PATH/FILENAMEpath and filename to configuration file *see below for mor information
--start-app APPLICATION NAME OR IDstarts an application
--app-metadata METADATAstring of information the application can use when it starts up. And example would be the browser. To have it open directly to a specific URL you would enter: "http\/\/www.some-web-address.com" wrapping the meta data in quotes will reduce the possibility of a command line parser error.
--key-help {OPTIONAL KEYS}prints out key help



Example use:

samsungctl --host 192.168.0.10 --name myremote KEY_VOLDOWN



To obtain a list of all of the known keys:

samsungctl --help-keys

You can also get help on a specific key:

samsungctl --key-help KEY_16_9

or if you wanted to list more then one key:

samsungctl --key-help KEY_16_9 KEY_TTX_MIX



--config-file


If this is the first time you are using this library on a TV you must specify --host and key code for the command you wish to execute along with this parameter.

samsungctl --host 192.168.1.100 --config-file "/PATH/FILE.NAME" KEY_MENU

By doing this is will make all of the necessary config file settings that are needed to be made for your TV. After the library has sent the command to your TV it will then save the file. Any calls there after will only need to have --config-file PATH/FILENAME along with the command you wish to perform for a command line options.

samsungctl --config-file "/PATH/FILE.NAME" KEY_MENU

All other information will be retrieved from the file.





***************

depreciated

***************

The settings can be loaded from a configuration file. The file is searched from

  • $XDG_CONFIG_HOME/samsungctl.conf
  • ~/.config/samsungctl.conf
  • /etc/samsungctl.conf

in this order. A simple default configuration is bundled with the source as

  • samsungctl.conf <samsungctl.conf>



Library usage

samsungctl can also be used as a python package.

    import samsungctl

A context managed remote controller object of class Remote can be constructed using the with statement:

    with samsungctl.Remote(config) as remote:
        # Use the remote object

Config Class


I have put into place a class that handles all of the configuration information. It makes it easier for saving and loading config data.

import samsungctl


config = samsungctl.Config(
    name='samsungctl',
    description='samsungctl-library',
    method='websocket',
    port=8001
)



The constructor for the Config class takes these parameters

I added a new parameter to the config class. This will allow for user entry of the mac address if there are issues with detecting it.

Param NameDefault valueParam TypeUse
name"samsungctl"strName of the "remote" this is the name that is going to appear on the TV
descriptionHOSTNAME of local PCstrOnly used in the legacy connection (pre 2014 TVs)
hostNonestrThe ip address of the TV "192.168.1.1"
portNoneintThe port to connect to. choices aree 55000 (< 2014), 8080 (2014 & 2015), 8001 & 8002 (>= 2016) or None *
methodNonestrConnection method ("legacy", "websocket", "encrypted" or None * )
idNonestrThis is an identifier that you can set. when using the "encrypted" method this should be left out
timeout0intsocket timeout, only used for the legacy method
tokenNonestrAuthentication token that is used for 2014 & 2015 and some 2016+ TV's
device_idNonestrInternal Use
upnp_locationsNonelistFuture Use
macNonestrMAC address of the TV "00:00:00:00:00" or None **.


* I have instituted a detection system that will automatically detect what connection type and port to use. In order to have the detection system activate the port and the method parameters in the call to Config MUST be None.

** The mac parameter in the config class does not have to be used if you are using a legacy connection, <= 2013 TV. if you are using a TV that is 2014 and newer if there is no mac address the power on feature will not work. If you do not specify a mac address and the TV is 2014 or newer the program will attempt to acquire the MAC address of the TV for you. in order for this to be successful you need to have your TV turned on. This process only needs to be done a single time if you are saving the configuration data using the save method. If for some reason we are unable to locate the MAC address for the TV you have the option of manually passing it to the call to Config. If you are entering it manually it needs to be formatted "00:00:00:00:00".

Here is a python script example of running samsungctl using all of the detection features activated remember in order for this to work you need to have the TV powered on. Since we only want to go through this process a single time (because it can take an extra second or 2) we want to save the configuration information to file. So be sure to enter the path and filename into the save method.

import samsungctl


config = samsungctl.Config(host='192.168.1.100')

with samsungctl.Remote(config) as remote:
    remote.KEY_MENU()

config.save('PATH/FILE.NAME')



the Config class is also where you set your logging level

import logging
import samsungctl


config = samsungctl.Config(
    name='samsungctl',
    method='websocket',
    host='192.168.1.100'
)

config.log_level = logging.DEBUG



There are 2 nice convenience methods for saving and loading a config file.

import samsungctl

config = samsungctl.Config.load('path/to/save/file')



If you load a file the path is saved so you can simply call save to save any new data. If you constructed the Config class manually you will need to pass a path when calling save. and that path is then saved so any subsequent calls to save will not require you to pass the path

import samsungctl


config = samsungctl.Config(
    name='samsungctl',
    description='samsungctl-library',
    method='websocket',
    host='192.168.1.100'
)

config.save('path/to/save/file')



when calling save if you pass only a folder path and not a folder/file path the name you passed to the constructor will be used along with the extension ".config"

You do not need to keep track of the config instance. once it is passed to the Remote constructor it is then stored in that instance.

import samsungctl


config = samsungctl.Config.load('path/to/save/file')
remote = samsungctl.Remote(config)
remote.config.save()



I also gave a little twist on the loading of the config file. I did this so there would not need to be 2 different code blocks one for initial setup and another for loading a saved file.

import samsungctl

config = samsungctl.Config.load('PATH/FILE.NAME')(
    name='samsungctl',
    description='samsungctl-library',
    method='websocket',
    host='192.168.1.100'
)

config.save()



The nifty thing about the code above is it allows for several things to happen

  1. It is not going to require 2 different config setup routines. only a single one is needed. If the file exists then it is used.
  2. If you happen to only specify a directory and want samsungctl to use the name parameter for the filename. this is what makes that possible.
  3. If the path does not exist. then it will create a new configuration with the supplied arguments and set the save of that config data.



    You are still able to pass a dictionary to the Remote constructor as well.



*** Depreciated The constructor takes a configuration dictionary as a parameter. All configuration items must be specified.



KeyTypeDescription
hoststringHostname or IP address of the TV.
portintTCP port number. (Default: 55000)
methodstringConnection method ("legacy" or "websocket")
namestringName of the remote controller.
descriptionstringRemote controller description.
idstringAdditional remote controller ID.
tokenstringAuthentication token
timeoutintTimeout in seconds. 0 means no timeout.


Power Property


Power status along with powering off and on 2014+ TV's



import samsungctl


config = samsungctl.Config.load('path/to/save/file')
remote = samsungctl.Remote(config)
print(remote.power)

# turns the TV on
remote.power = True

print(remote.power)
# turns the TV off
remote.power = False

# toggles the power
remote.power = not remote.power



We do not have the ability to turn on the TV's older then 2014.



Exceptions


When something goes wrong you will receive an exception:

ExceptionDescription
SamsungTVErrorSamsung TV Exception Base Class.
AccessDeniedConnection was denied.
ConnectionClosedConnection was closed.
UnhandledResponseReceived unknown response.
NoTVFoundUnable to locate a TV.
ConfigErrorBase class for config exceptions.
ConfigUnknownMethodUnknown connection method.
ConfigParseErrorConfig data is not json formatted or is not a formatted flat file.
ConfigLoadErrorConfig path specified cannot be located.
ConfigSavePathErrorConfig save path is not valid.
ConfigSaveErrorError saving config.
ConfigSavePathNotSpecifiedConfig save path was not specified.
ConfigParameterErrorParameter is not a config parameter.


Example program


This simple program opens and closes the menu a few times.

import samsungctl
import time

config = samsungctl.Config(
    name='samsungctl',
    method='legacy',
    host='192.168.1.100'
)

with samsungctl.Remote(config) as remote:
    for i in range(10):
        remote.control("KEY_MENU")
        time.sleep(0.5)



Mouse Control


Mouse control can only be done by using samsungctl as a python module. Mouse command are built. this way you can accomplish multiple movements in a single "command" and the movement set can be stored for later use. depending on how long it takes to accomplish a movement (distance traveled) you will need to insert a wait period in between each movement.

import samsungctl

config = samsungctl.Config(
    name='samsungctl',
    method='websocket',
    host='192.168.1.100'
)

with samsungctl.Remote(config) as remote:
    mouse = remote.mouse
    mouse.move(x=100, y=300)
    mouse.wait(0.5)
    mouse.left_click()
    mouse.run()
    mouse.clear()



I designed this to all be thread safe. so only one mouse command set can be run at a single time. So if you have the mouse running in a thread and you need to stop the movement from another. or you simply want to terminate the program gracefully. you would call mouse.stop()

I will be at a later date adding the wait periods on the mouse movements so it will be done automatically. I do not own one of the TV's so I do not know how long it takes to move the mouse different distances. I also do not know if the time it takes to move the mouse is linear. An example of linear movement would be it takes 1 second to move the mouse 100 pixels so to move it 200 pixels it would take 2 seconds. most devices that have mouse control also have acceleration and a min/max speed which would be non linear movement. An example of non linear is, if it took 1 second to move the mouse 100 pixels, to move it 200 it would take 1.5 seconds. You can run the code below and report the output to me. that will aide in making this all automatic. I need this data form several TV models and years. as Samsung could have changed the mouse speed and acceleration between years/models.

import samsungctl
import time


config = samsungctl.Config(
    name='samsungctl',
    method='websocket',
    host='192.168.1.100'
)

with samsungctl.Remote(config) as remote:
     mouse = remote.mouse

    def move_mouse(_x, _y):
        mouse.move(x=x, y=y)
        start = time.time()
        mouse.run()
        stop = time.time()
        print('x:', x, 'y:', y, 'time:', (stop - start) * 1000)
        mouse.clear()
        mouse.move(x=-x, y=-y)
        mouse.run()
        mouse.clear()

    for x in range(1920):
        move_mouse(x, 0)

        for y in range(1080):
            move_mouse(0, y)
            move_mouse(x, y)



Voice Recognition


If you TV supports voice recognition you have the ability to start and stop the voice recognition service on the TV. this can be done only by using the samsungctl library as a package to an already existing program. example code of how to do this is below.

import samsungctl
import time

config = samsungctl.Config(
    name='samsungctl',
    method='websocket',
    host='192.168.1.100'
)

with samsungctl.Remote(config) as remote:
    remote.start_voice_recognition()
    time.sleep(5.0)
    remote.stop_voice_recognition()



Applications


This is going to be a wee bit long winded. But here goes

below is a sample of how to access the applications on the TV

import samsungctl

config = samsungctl.Config(
    name='samsungctl',
    method='websocket',
    host='192.168.1.100'
)

with samsungctl.Remote(config) as remote:
    for app in remote.applications:
        print('name:', app.name)
        print('=' * 30)
        print('id:', app.app_id)
        print('is running:', app.is_running)
        print('version:', app.version)
        print()



if you want to access a specific application by name or by the app id

import samsungctl

config = samsungctl.Config(
    name='samsungctl',
    method='websocket',
    host='192.168.1.100'
)

with samsungctl.Remote(config) as remote:
    app = remote.get_application('YouTube')
    if app is not None:
        print('name:', app.name)
        print('=' * 30)
        print('id:', app.app_id)
        print('is running:', app.is_running)
        print('version:', app.version)
        print()



these are the available properties for an application

  • is_lock
  • name
  • app_type
  • position
  • app_id
  • launcher_type
  • mbr_index
  • source_type_num
  • icon
  • id
  • mbr_source
  • action_type
  • version
  • is_visible
  • is_running



now here is a little bonus. we can also iterate over an application for any content groups. and then we can iterate over the content group for the available content in that group

import samsungctl

config = samsungctl.Config(
    name='samsungctl',
    method='websocket',
    host='192.168.1.100'
)

with samsungctl.Remote(config) as remote:
    for app in remote.applications:
        print('name:', app.name)
        print('=' * 30)
        for content_group in app:
            print('   ', content_group.title)
            print('   ', '-' * 26)
            for content in content_group:
                print('       ', content.title)



here are the available properties for the content group

  • title



here are the available properties for the content

  • is_playable
  • subtitle
  • app_type
  • title
  • mbr_index
  • live_launcher_type
  • action_play_url
  • service_id
  • launcher_type
  • source_type_num
  • action_type
  • app_id
  • subtitle2
  • display_from
  • display_until
  • mbr_source
  • id
  • subtitle3
  • icon



You can also run an application or a piece of content by calling run() on either an application or on the content.

Key codes

Here is the new list of keycodes that are supported.



Power Keys


KeyDescription
KEY_POWEROFFPowerOFF
KEY_POWERONPowerOn
KEY_POWERPowerToggle



Input Keys


KeyDescription
KEY_SOURCESource
KEY_COMPONENT1Component1
KEY_COMPONENT2Component2
KEY_AV1AV1
KEY_AV2AV2
KEY_AV3AV3
KEY_SVIDEO1SVideo1
KEY_SVIDEO2SVideo2
KEY_SVIDEO3SVideo3
KEY_HDMIHDMI
KEY_HDMI1HDMI1
KEY_HDMI2HDMI2
KEY_HDMI3HDMI3
KEY_HDMI4HDMI4
KEY_FM_RADIOFMRadio
KEY_DVIDVI
KEY_DVRDVR
KEY_TVTV
KEY_ANTENAAnalogTV
KEY_DTVDigitalTV



Number Keys


KeyDescription
KEY_1Key1
KEY_2Key2
KEY_3Key3
KEY_4Key4
KEY_5Key5
KEY_6Key6
KEY_7Key7
KEY_8Key8
KEY_9Key9
KEY_0Key0



Misc Keys


KeyDescription
KEY_PANNEL_CHDOWN3D
KEY_ANYNETAnyNet+
KEY_ESAVINGEnergySaving
KEY_SLEEPSleepTimer
KEY_DTV_SIGNALDTVSignal



Channel Keys


KeyDescription
KEY_CHUPChannelUp
KEY_CHDOWNChannelDown
KEY_PRECHPreviousChannel
KEY_FAVCHFavoriteChannels
KEY_CH_LISTChannelList
KEY_AUTO_PROGRAMAutoProgram
KEY_MAGIC_CHANNELMagicChannel



Volume Keys


KeyDescription
KEY_VOLUPVolumeUp
KEY_VOLDOWNVolumeDown
KEY_MUTEMute



Direction Keys


KeyDescription
KEY_UPNavigationUp
KEY_DOWNNavigationDown
KEY_LEFTNavigationLeft
KEY_RIGHTNavigationRight
KEY_RETURNNavigationReturn/Back
KEY_ENTERNavigationEnter



Media Keys


KeyDescription
KEY_REWINDRewind
KEY_STOPStop
KEY_PLAYPlay
KEY_FFFastForward
KEY_RECRecord
KEY_PAUSEPause
KEY_LIVELive
KEY_QUICK_REPLAYfnKEY_QUICK_REPLAY
KEY_STILL_PICTUREfnKEY_STILL_PICTURE
KEY_INSTANT_REPLAYfnKEY_INSTANT_REPLAY



Picture in Picture


KeyDescription
KEY_PIP_ONOFFPIPOn/Off
KEY_PIP_SWAPPIPSwap
KEY_PIP_SIZEPIPSize
KEY_PIP_CHUPPIPChannelUp
KEY_PIP_CHDOWNPIPChannelDown
KEY_AUTO_ARC_PIP_SMALLPIPSmall
KEY_AUTO_ARC_PIP_WIDEPIPWide
KEY_AUTO_ARC_PIP_RIGHT_BOTTOMPIPBottomRight
KEY_AUTO_ARC_PIP_SOURCE_CHANGEPIPSourceChange
KEY_PIP_SCANPIPScan



Modes


KeyDescription
KEY_VCR_MODEVCRMode
KEY_CATV_MODECATVMode
KEY_DSS_MODEDSSMode
KEY_TV_MODETVMode
KEY_DVD_MODEDVDMode
KEY_STB_MODESTBMode
KEY_PCMODEPCMode



Color Keys


KeyDescription
KEY_GREENGreen
KEY_YELLOWYellow
KEY_CYANCyan
KEY_REDRed



Teletext


KeyDescription
KEY_TTX_MIXTeletextMix
KEY_TTX_SUBFACETeletextSubface



AspectRatio


KeyDescription
KEY_ASPECTAspectRatio
KEY_PICTURE_SIZEPictureSize
KEY_4_3AspectRatio4:3
KEY_16_9AspectRatio16:9
KEY_EXT14AspectRatio3:4(Alt)
KEY_EXT15AspectRatio16:9(Alt)

Picture Mode


KeyDescription
KEY_PMODEPictureMode
KEY_PANORAMAPictureModePanorama
KEY_DYNAMICPictureModeDynamic
KEY_STANDARDPictureModeStandard
KEY_MOVIE1PictureModeMovie
KEY_GAMEPictureModeGame
KEY_CUSTOMPictureModeCustom
KEY_EXT9PictureModeMovie(Alt)
KEY_EXT10PictureModeStandard(Alt)



Menus


KeyDescription
KEY_MENUMenu
KEY_TOPMENUTopMenu
KEY_TOOLSTools
KEY_HOMEHome
KEY_CONTENTSContents
KEY_GUIDEGuide
KEY_DISC_MENUDiscMenu
KEY_DVR_MENUDVRMenu
KEY_HELPHelp



OSD


KeyDescription
KEY_INFOInfo
KEY_CAPTIONCaption
KEY_CLOCK_DISPLAYClockDisplay
KEY_SETUP_CLOCK_TIMERSetupClock
KEY_SUB_TITLESubtitle



Zoom


KeyDescription
KEY_ZOOM_MOVEZoomMove
KEY_ZOOM_INZoomIn
KEY_ZOOM_OUTZoomOut
KEY_ZOOM1Zoom1
KEY_ZOOM2Zoom2



Other Keys


KeyDescription
KEY_WHEEL_LEFTWheelLeft
KEY_WHEEL_RIGHTWheelRight
KEY_ADDDELAdd/Del
KEY_PLUS100Plus100
KEY_ADAD
KEY_LINKLink
KEY_TURBOTurbo
KEY_CONVERGENCEConvergence
KEY_DEVICE_CONNECTDeviceConnect
KEY_11Key11
KEY_12Key12
KEY_FACTORYKeyFactory
KEY_3SPEEDKey3SPEED
KEY_RSURFKeyRSURF
KEY_FF_FF_
KEY_REWIND_REWIND_
KEY_ANGLEAngle
KEY_RESERVED1Reserved1
KEY_PROGRAMProgram
KEY_BOOKMARKBookmark
KEY_PRINTPrint
KEY_CLEARClear
KEY_VCHIPVChip
KEY_REPEATRepeat
KEY_DOORDoor
KEY_OPENOpen
KEY_DMADMA
KEY_MTSMTS
KEY_DNIeDNIe
KEY_SRSSRS
KEY_CONVERT_AUDIO_MAINSUBConvertAudioMain/Sub
KEY_MDCMDC
KEY_SEFFECTSoundEffect
KEY_PERPECT_FOCUSPERPECTFocus
KEY_CALLER_IDCallerID
KEY_SCALEScale
KEY_MAGIC_BRIGHTMagicBright
KEY_W_LINKWLink
KEY_DTV_LINKDTVLink
KEY_APP_LISTApplicationList
KEY_BACK_MHPBackMHP
KEY_ALT_MHPAlternateMHP
KEY_DNSeDNSe
KEY_RSSRSS
KEY_ENTERTAINMENTEntertainment
KEY_ID_INPUTIDInput
KEY_ID_SETUPIDSetup
KEY_ANYVIEWAnyView
KEY_MSMS
KEY_MORE
KEY_MIC
KEY_NINE_SEPERATE
KEY_AUTO_FORMATAutoFormat
KEY_DNETDNET



Auto Arc Keys


KeyDescription
KEY_AUTO_ARC_C_FORCE_AGING
KEY_AUTO_ARC_CAPTION_ENG
KEY_AUTO_ARC_USBJACK_INSPECT
KEY_AUTO_ARC_RESET
KEY_AUTO_ARC_LNA_ON
KEY_AUTO_ARC_LNA_OFF
KEY_AUTO_ARC_ANYNET_MODE_OK
KEY_AUTO_ARC_ANYNET_AUTO_START
KEY_AUTO_ARC_CAPTION_ON
KEY_AUTO_ARC_CAPTION_OFF
KEY_AUTO_ARC_PIP_DOUBLE
KEY_AUTO_ARC_PIP_LARGE
KEY_AUTO_ARC_PIP_LEFT_TOP
KEY_AUTO_ARC_PIP_RIGHT_TOP
KEY_AUTO_ARC_PIP_LEFT_BOTTOM
KEY_AUTO_ARC_PIP_CH_CHANGE
KEY_AUTO_ARC_AUTOCOLOR_SUCCESS
KEY_AUTO_ARC_AUTOCOLOR_FAIL
KEY_AUTO_ARC_JACK_IDENT
KEY_AUTO_ARC_CAPTION_KOR
KEY_AUTO_ARC_ANTENNA_AIR
KEY_AUTO_ARC_ANTENNA_CABLE
KEY_AUTO_ARC_ANTENNA_SATELLITE



Panel Keys


KeyDescription
KEY_PANNEL_POWER
KEY_PANNEL_CHUP
KEY_PANNEL_VOLUP
KEY_PANNEL_VOLDOW
KEY_PANNEL_ENTER
KEY_PANNEL_MENU
KEY_PANNEL_SOURCE
KEY_PANNEL_ENTER



Extended Keys


KeyDescription
KEY_EXT1
KEY_EXT2
KEY_EXT3
KEY_EXT4
KEY_EXT5
KEY_EXT6
KEY_EXT7
KEY_EXT8
KEY_EXT11
KEY_EXT12
KEY_EXT13
KEY_EXT16
KEY_EXT17
KEY_EXT18
KEY_EXT19
KEY_EXT20
KEY_EXT21
KEY_EXT22
KEY_EXT23
KEY_EXT24
KEY_EXT25
KEY_EXT26
KEY_EXT27
KEY_EXT28
KEY_EXT29
KEY_EXT30
KEY_EXT31
KEY_EXT32
KEY_EXT33
KEY_EXT34
KEY_EXT35
KEY_EXT36
KEY_EXT37
KEY_EXT38
KEY_EXT39
KEY_EXT40
KEY_EXT41





Please note that some codes are different on the 2016+ TVs. For example, KEY_POWEROFF is KEY_POWER on the newer TVs.

I also added all of the keys as methods. so you have the choice of using the method for sending a key

import samsungctl

config = samsungctl.Config(
    name='samsungctl',
    method='websocket',
    host='192.168.1.100'
)

with samsungctl.Remote(config) as remote:
    remote.command("KEY_VOLUP")



or you can also use this

import samsungctl

config = samsungctl.Config(
    name='samsungctl',
    method='websocket',
    host='192.168.1.100'
)

with samsungctl.Remote(config) as remote:
    remote.KEY_VOLUP()







References

I did not reverse engineer the control protocol myself and samsungctl is not the only implementation. Here is the list of things that inspired samsungctl.