{"id":21997683,"url":"https://github.com/osfunapps/samsungctloriginal","last_synced_at":"2025-03-23T04:45:09.482Z","repository":{"id":86428917,"uuid":"155396050","full_name":"osfunapps/samsungCTLOriginal","owner":"osfunapps","description":null,"archived":false,"fork":false,"pushed_at":"2018-11-01T09:01:11.000Z","size":14,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-28T11:32:16.715Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/osfunapps.png","metadata":{"files":{"readme":"README.rst","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-10-30T14:07:55.000Z","updated_at":"2018-11-01T09:01:12.000Z","dependencies_parsed_at":"2023-07-13T21:01:35.529Z","dependency_job_id":null,"html_url":"https://github.com/osfunapps/samsungCTLOriginal","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/osfunapps%2FsamsungCTLOriginal","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/osfunapps%2FsamsungCTLOriginal/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/osfunapps%2FsamsungCTLOriginal/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/osfunapps%2FsamsungCTLOriginal/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/osfunapps","download_url":"https://codeload.github.com/osfunapps/samsungCTLOriginal/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245056902,"owners_count":20553854,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-29T22:17:41.637Z","updated_at":"2025-03-23T04:45:09.468Z","avatar_url":"https://github.com/osfunapps.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"==========\nsamsungctl\n==========\n\nsamsungctl is a library and a command line tool for remote controlling Samsung\ntelevisions via a TCP/IP connection. It currently supports both pre-2016 TVs as\nwell most of the modern Tizen-OS TVs with Ethernet or Wi-Fi connectivity.\n\nDependencies\n============\n\n- Python 3\n- ``websocket-client`` (optional, for 2016+ TVs)\n- ``curses`` (optional, for the interactive mode)\n\nInstallation\n============\n\nsamsungctl can be installed using `pip \u003c(https://pip.pypa.io/\u003e`_:\n\n::\n\n    # pip install samsungctl\n\nAlternatively you can clone the Git repository and run:\n\n::\n\n    # python setup.py install\n\nIt's possible to use the command line tool without installation:\n\n::\n\n    $ python -m samsungctl\n\nCommand line usage\n==================\n\nYou can use ``samsungctl`` command to send keys to a TV:\n\n::\n\n    $ samsungctl --host \u003chost\u003e [options] \u003ckey\u003e [key ...]\n\n``host`` is the hostname or IP address of the TV. ``key`` is a key code, e.g.\n``KEY_VOLDOWN``. See `Key codes`_.\n\nThere is also an interactive mode (ncurses) for sending the key presses:\n\n::\n\n    $ samsungctl --host \u003chost\u003e [options] --interactive\n\nUse ``samsungctl --help`` for more information about the command line\narguments:\n\n::\n\n    usage: samsungctl [-h] [--version] [-v] [-q] [-i] [--host HOST] [--port PORT]\n                      [--method METHOD] [--name NAME] [--description DESC]\n                      [--id ID] [--timeout TIMEOUT]\n                      [key [key ...]]\n\n    Remote control Samsung televisions via TCP/IP connection\n\n    positional arguments:\n      key                 keys to be sent (e.g. KEY_VOLDOWN)\n\n    optional arguments:\n      -h, --help          show this help message and exit\n      --version           show program's version number and exit\n      -v, --verbose       increase output verbosity\n      -q, --quiet         suppress non-fatal output\n      -i, --interactive   interactive control\n      --host HOST         TV hostname or IP address\n      --port PORT         TV port number (TCP)\n      --method METHOD     Connection method (legacy or websocket)\n      --name NAME         remote control name\n      --description DESC  remote control description\n      --id ID             remote control id\n      --timeout TIMEOUT   socket timeout in seconds (0 = no timeout)\n\n    E.g. samsungctl --host 192.168.0.10 --name myremote KEY_VOLDOWN\n\nThe settings can be loaded from a configuration file. The file is searched from\n``$XDG_CONFIG_HOME/samsungctl.conf``, ``~/.config/samsungctl.conf``, and\n``/etc/samsungctl.conf`` in this order. A simple default configuration is\nbundled with the source as `samsungctl.conf \u003csamsungctl.conf\u003e`_.\n\nLibrary usage\n=============\n\nsamsungctl can be imported as a Python 3 library:\n\n.. code-block:: python\n\n    import samsungctl\n\nA context managed remote controller object of class ``Remote`` can be\nconstructed using the ``with`` statement:\n\n.. code-block:: python\n\n    with samsungctl.Remote(config) as remote:\n        # Use the remote object\n\nThe constructor takes a configuration dictionary as a parameter. All\nconfiguration items must be specified.\n\n===========  ======  ===========================================\nKey          Type    Description\n===========  ======  ===========================================\nhost         string  Hostname or IP address of the TV.\nport         int     TCP port number. (Default: ``55000``)\nmethod       string  Connection method (``legacy`` or ``websocket``)\nname         string  Name of the remote controller.\ndescription  string  Remote controller description.\nid           string  Additional remote controller ID.\ntimeout      int     Timeout in seconds. ``0`` means no timeout.\n===========  ======  ===========================================\n\nThe ``Remote`` object is very simple and you only need the ``control(key)``\nmethod. The only parameter is a string naming the key to be sent (e.g.\n``KEY_VOLDOWN``). See `Key codes`_. You can call ``control`` multiple times\nusing the same ``Remote`` object. The connection is automatically closed when\nexiting the ``with`` statement.\n\nWhen something goes wrong you will receive an exception:\n\n=================  =======================================\nException          Description\n=================  =======================================\nAccessDenied       The TV does not allow you to send keys.\nConnectionClosed   The connection was closed.\nUnhandledResponse  An unexpected response was received.\nsocket.timeout     The connection timed out.\n=================  =======================================\n\nExample program\n---------------\n\nThis simple program opens and closes the menu a few times.\n\n.. code-block:: python\n\n    #!/usr/bin/env python3\n\n    import samsungctl\n    import time\n\n    config = {\n        \"name\": \"samsungctl\",\n        \"description\": \"PC\",\n        \"id\": \"\",\n        \"host\": \"192.168.0.10\",\n        \"port\": 55000,\n        \"method\": \"legacy\",\n        \"timeout\": 0,\n    }\n\n    with samsungctl.Remote(config) as remote:\n        for i in range(10):\n            remote.control(\"KEY_MENU\")\n            time.sleep(0.5)\n\nKey codes\n=========\n\nThe list of accepted keys may vary depending on the TV model, but the following\nlist has some common key codes and their descriptions.\n\n=================  ============\nKey code           Description\n=================  ============\nKEY_POWEROFF       Power off\nKEY_UP             Up\nKEY_DOWN           Down\nKEY_LEFT           Left\nKEY_RIGHT          Right\nKEY_CHUP           P Up\nKEY_CHDOWN         P Down\nKEY_ENTER          Enter\nKEY_RETURN         Return\nKEY_CH_LIST        Channel List\nKEY_MENU           Menu\nKEY_SOURCE         Source\nKEY_GUIDE          Guide\nKEY_TOOLS          Tools\nKEY_INFO           Info\nKEY_RED            A / Red\nKEY_GREEN          B / Green\nKEY_YELLOW         C / Yellow\nKEY_BLUE           D / Blue\nKEY_PANNEL_CHDOWN  3D\nKEY_VOLUP          Volume Up\nKEY_VOLDOWN        Volume Down\nKEY_MUTE           Mute\nKEY_0              0\nKEY_1              1\nKEY_2              2\nKEY_3              3\nKEY_4              4\nKEY_5              5\nKEY_6              6\nKEY_7              7\nKEY_8              8\nKEY_9              9\nKEY_DTV            TV Source\nKEY_HDMI           HDMI Source\nKEY_CONTENTS       SmartHub\n=================  ============\n\nPlease note that some codes are different on the 2016+ TVs. For example,\n``KEY_POWEROFF`` is ``KEY_POWER`` on the newer TVs.\n\nReferences\n==========\n\nI did not reverse engineer the control protocol myself and samsungctl is not\nthe only implementation. Here is the list of things that inspired samsungctl.\n\n- http://sc0ty.pl/2012/02/samsung-tv-network-remote-control-protocol/\n- https://gist.github.com/danielfaust/998441\n- https://github.com/Bntdumas/SamsungIPRemote\n- https://github.com/kyleaa/homebridge-samsungtv2016\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fosfunapps%2Fsamsungctloriginal","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fosfunapps%2Fsamsungctloriginal","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fosfunapps%2Fsamsungctloriginal/lists"}