lirc


Namelirc JSON
Version 2.0.2 PyPI version JSON
download
home_pagehttps://github.com/eugenetriguba/lirc
SummaryInteract with the daemon in the Linux Infrared Remote Control package
upload_time2022-11-25 17:51:04
maintainer
docs_urlNone
authorEugene Triguba
requires_python>=3.6,<4.0
licenseMIT
keywords lirc ir
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage
            LIRC Python Package
===================

.. image:: https://img.shields.io/pypi/pyversions/lirc
   :target: https://www.python.org/downloads/
   :alt: Python Version
.. image:: https://img.shields.io/pypi/v/lirc
   :target: https://pypi.org/project/lirc/
   :alt: Project Version
.. image:: https://readthedocs.org/projects/lirc/badge/?version=latest
  :target: https://lirc.readthedocs.io/en/latest/?badge=latest
  :alt: Documentation Status
.. image:: https://github.com/eugenetriguba/lirc/workflows/python%20package%20ci/badge.svg?branch=master
  :target: https://github.com/eugenetriguba/lirc/actions/
  :alt: Build Status
.. image:: https://codecov.io/gh/eugenetriguba/lirc/graph/badge.svg
  :target: https://codecov.io/gh/eugenetriguba/lirc
  :alt: Code Coverage
.. image:: https://api.codeclimate.com/v1/badges/62b96571ae84f2895531/maintainability
   :target: https://codeclimate.com/github/eugenetriguba/lirc/maintainability
   :alt: Maintainability
.. image:: https://img.shields.io/badge/code%20style-black-000000.svg
    :target: https://github.com/psf/black
    :alt: Code Formatter
.. image:: https://img.shields.io/badge/contributions-welcome-brightgreen.svg
    :target: https://github.com/eugenetriguba/lirc/issues
    :alt: Contributing
.. image:: https://img.shields.io/pypi/l/lirc
   :target: https://pypi.python.org/pypi/lirc/
   :alt: License
.. image:: https://img.shields.io/badge/platform-linux%20%7C%20macos%20%7C%20windows-%23F9F9F9
   :target: https://lirc.readthedocs.io/en/latest/installation.html
   :alt: Platform Support

This is a python package that allows you to interact with the daemon in the
`Linux Infrared Remote Control <https://lirc.org>`_ package. By interacting
with this daemon, it allows you to programmatically send IR signals from a
computer.

This package is for emitting IR signals, but it does not support listening to
IR codes. If you'd like to monitor the IR signals you recieve on
Linux, which has built-in support in the kernel for recieving IR signals, you
can try using `python-evdev <https://python-evdev.readthedocs.io/en/latest/>`_.
They have a `tutorial on reading the events <https://python-evdev.readthedocs.io/en/latest/tutorial.html#reading-events>`_.

More information on the lircd daemon, socket interface,
reply packet format, etc. can be found at https://www.lirc.org/html/lircd.html

Maintainance Status
-------------------

This project is maintained, but it is not actively developed.
It is feature complete for my purposes.

Installation
------------

This package is hosted on PyPI and can be installed
through pip.

.. code-block:: bash

  $ pip install lirc

However since this is a wrapper around the LIRC daemon, it
is expected that LIRC is installed and setup on the given
system as well.

More information on that can be found in the `installation <https://lirc.readthedocs.io/en/latest/installation.html>`_
portion of the full documentation.

Quick Start
-----------

Using the Client
^^^^^^^^^^^^^^^^

.. code-block:: python

  import lirc

  client = lirc.Client()

  print(client.version())
  >>> '0.10.1'

To use this package, we instantiate a ``Client``. By initializing it
with no arguments, the ``Client`` will attempt to connect to the lirc
daemon with the default connection parameters for your operating system.

These defaults depend on your operating system and can be looked up in the
full documentation if you need different parameters.

However, if you've instantiated the ``Client`` without any arguments,
you don't get any errors, and you recieve a response from the ``version()``
command, you are connected to the daemon. Most people should not need to
change the default parameters.

Customizing the Client
^^^^^^^^^^^^^^^^^^^^^^

As previously stated, we can customize these defaults if needed.

.. code-block:: python

  import socket
  import lirc

  client = lirc.Client(
    connection=lirc.LircdConnection(
      address="/var/run/lirc/lircd",
      socket=socket.socket(socket.AF_UNIX, socket.SOCK_STREAM),
      timeout = 5.0
    )
  )

For the client in the example above, we set it up using the defaults for a Linux machine.
While this example illustrates what is customizable, it is not a practical example since
you could call ``Client()`` with no arguments if you're on Linux and achieve the same outcome.

See `Overriding LIRC Defaults on Initialization <https://lirc.readthedocs.io/en/stable/usage.html#overriding-lirc-defaults-on-initialization>`_
for more information.

Sending IR
^^^^^^^^^^

.. code-block:: python

  import lirc

  client = lirc.Client()
  client.send_once("my-remote-name", "KEY_POWER")

  # Go to channel "33"
  client.send_once("my-remote-name", "KEY_3", repeat_count=1)


With sending IR, we can use the `send_once` method and optionally,
send multiple by using the `repeat_count` keyword argument.

Handling Errors
^^^^^^^^^^^^^^^

.. code-block:: python

  import lirc

  client = lirc.Client()

  try:
      client.send_once('some-remote', 'key_power')
  except lirc.exceptions.LircdCommandFailureError as error:
      print('Unable to send the power key!')
      print(error)  # Error has more info on what lircd sent back.

If the command was not successful, a ``LircdCommandFailureError``
exception will be thrown.

Further Documentation
---------------------

More information on how to setup the system installed LIRC, how to use
this python library, and a full API specification can be found at
https://lirc.readthedocs.io/

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/eugenetriguba/lirc",
    "name": "lirc",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.6,<4.0",
    "maintainer_email": "",
    "keywords": "LIRC,IR",
    "author": "Eugene Triguba",
    "author_email": "eugenetriguba@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/91/5e/2a6680cbd5c8853d1483463ded4be93accfa623060e171123da1c5fbeecc/lirc-2.0.2.tar.gz",
    "platform": null,
    "description": "LIRC Python Package\n===================\n\n.. image:: https://img.shields.io/pypi/pyversions/lirc\n   :target: https://www.python.org/downloads/\n   :alt: Python Version\n.. image:: https://img.shields.io/pypi/v/lirc\n   :target: https://pypi.org/project/lirc/\n   :alt: Project Version\n.. image:: https://readthedocs.org/projects/lirc/badge/?version=latest\n  :target: https://lirc.readthedocs.io/en/latest/?badge=latest\n  :alt: Documentation Status\n.. image:: https://github.com/eugenetriguba/lirc/workflows/python%20package%20ci/badge.svg?branch=master\n  :target: https://github.com/eugenetriguba/lirc/actions/\n  :alt: Build Status\n.. image:: https://codecov.io/gh/eugenetriguba/lirc/graph/badge.svg\n  :target: https://codecov.io/gh/eugenetriguba/lirc\n  :alt: Code Coverage\n.. image:: https://api.codeclimate.com/v1/badges/62b96571ae84f2895531/maintainability\n   :target: https://codeclimate.com/github/eugenetriguba/lirc/maintainability\n   :alt: Maintainability\n.. image:: https://img.shields.io/badge/code%20style-black-000000.svg\n    :target: https://github.com/psf/black\n    :alt: Code Formatter\n.. image:: https://img.shields.io/badge/contributions-welcome-brightgreen.svg\n    :target: https://github.com/eugenetriguba/lirc/issues\n    :alt: Contributing\n.. image:: https://img.shields.io/pypi/l/lirc\n   :target: https://pypi.python.org/pypi/lirc/\n   :alt: License\n.. image:: https://img.shields.io/badge/platform-linux%20%7C%20macos%20%7C%20windows-%23F9F9F9\n   :target: https://lirc.readthedocs.io/en/latest/installation.html\n   :alt: Platform Support\n\nThis is a python package that allows you to interact with the daemon in the\n`Linux Infrared Remote Control <https://lirc.org>`_ package. By interacting\nwith this daemon, it allows you to programmatically send IR signals from a\ncomputer.\n\nThis package is for emitting IR signals, but it does not support listening to\nIR codes. If you'd like to monitor the IR signals you recieve on\nLinux, which has built-in support in the kernel for recieving IR signals, you\ncan try using `python-evdev <https://python-evdev.readthedocs.io/en/latest/>`_.\nThey have a `tutorial on reading the events <https://python-evdev.readthedocs.io/en/latest/tutorial.html#reading-events>`_.\n\nMore information on the lircd daemon, socket interface,\nreply packet format, etc. can be found at https://www.lirc.org/html/lircd.html\n\nMaintainance Status\n-------------------\n\nThis project is maintained, but it is not actively developed.\nIt is feature complete for my purposes.\n\nInstallation\n------------\n\nThis package is hosted on PyPI and can be installed\nthrough pip.\n\n.. code-block:: bash\n\n  $ pip install lirc\n\nHowever since this is a wrapper around the LIRC daemon, it\nis expected that LIRC is installed and setup on the given\nsystem as well.\n\nMore information on that can be found in the `installation <https://lirc.readthedocs.io/en/latest/installation.html>`_\nportion of the full documentation.\n\nQuick Start\n-----------\n\nUsing the Client\n^^^^^^^^^^^^^^^^\n\n.. code-block:: python\n\n  import lirc\n\n  client = lirc.Client()\n\n  print(client.version())\n  >>> '0.10.1'\n\nTo use this package, we instantiate a ``Client``. By initializing it\nwith no arguments, the ``Client`` will attempt to connect to the lirc\ndaemon with the default connection parameters for your operating system.\n\nThese defaults depend on your operating system and can be looked up in the\nfull documentation if you need different parameters.\n\nHowever, if you've instantiated the ``Client`` without any arguments,\nyou don't get any errors, and you recieve a response from the ``version()``\ncommand, you are connected to the daemon. Most people should not need to\nchange the default parameters.\n\nCustomizing the Client\n^^^^^^^^^^^^^^^^^^^^^^\n\nAs previously stated, we can customize these defaults if needed.\n\n.. code-block:: python\n\n  import socket\n  import lirc\n\n  client = lirc.Client(\n    connection=lirc.LircdConnection(\n      address=\"/var/run/lirc/lircd\",\n      socket=socket.socket(socket.AF_UNIX, socket.SOCK_STREAM),\n      timeout = 5.0\n    )\n  )\n\nFor the client in the example above, we set it up using the defaults for a Linux machine.\nWhile this example illustrates what is customizable, it is not a practical example since\nyou could call ``Client()`` with no arguments if you're on Linux and achieve the same outcome.\n\nSee `Overriding LIRC Defaults on Initialization <https://lirc.readthedocs.io/en/stable/usage.html#overriding-lirc-defaults-on-initialization>`_\nfor more information.\n\nSending IR\n^^^^^^^^^^\n\n.. code-block:: python\n\n  import lirc\n\n  client = lirc.Client()\n  client.send_once(\"my-remote-name\", \"KEY_POWER\")\n\n  # Go to channel \"33\"\n  client.send_once(\"my-remote-name\", \"KEY_3\", repeat_count=1)\n\n\nWith sending IR, we can use the `send_once` method and optionally,\nsend multiple by using the `repeat_count` keyword argument.\n\nHandling Errors\n^^^^^^^^^^^^^^^\n\n.. code-block:: python\n\n  import lirc\n\n  client = lirc.Client()\n\n  try:\n      client.send_once('some-remote', 'key_power')\n  except lirc.exceptions.LircdCommandFailureError as error:\n      print('Unable to send the power key!')\n      print(error)  # Error has more info on what lircd sent back.\n\nIf the command was not successful, a ``LircdCommandFailureError``\nexception will be thrown.\n\nFurther Documentation\n---------------------\n\nMore information on how to setup the system installed LIRC, how to use\nthis python library, and a full API specification can be found at\nhttps://lirc.readthedocs.io/\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Interact with the daemon in the Linux Infrared Remote Control package",
    "version": "2.0.2",
    "project_urls": {
        "Homepage": "https://github.com/eugenetriguba/lirc",
        "Repository": "https://github.com/eugenetriguba/lirc"
    },
    "split_keywords": [
        "lirc",
        "ir"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "fc49ddd64f43a4c0cd920bd0a8a7aebbbfad2f4d80cf57c954b278b9eb62cac0",
                "md5": "5c27936136f5c96d39c4d6141d0719b5",
                "sha256": "7d750a93bbbe3e3fa27300415e45fca6fac7e39c5003d31f12768bb7473ed944"
            },
            "downloads": -1,
            "filename": "lirc-2.0.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "5c27936136f5c96d39c4d6141d0719b5",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.6,<4.0",
            "size": 12905,
            "upload_time": "2022-11-25T17:51:02",
            "upload_time_iso_8601": "2022-11-25T17:51:02.389072Z",
            "url": "https://files.pythonhosted.org/packages/fc/49/ddd64f43a4c0cd920bd0a8a7aebbbfad2f4d80cf57c954b278b9eb62cac0/lirc-2.0.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "915e2a6680cbd5c8853d1483463ded4be93accfa623060e171123da1c5fbeecc",
                "md5": "6e38f711e9dce954944e5c9d46ba0e10",
                "sha256": "c378660c11e7190c9226055698d808ec4f9f097fee3d8ef93bd3f4918ac99140"
            },
            "downloads": -1,
            "filename": "lirc-2.0.2.tar.gz",
            "has_sig": false,
            "md5_digest": "6e38f711e9dce954944e5c9d46ba0e10",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6,<4.0",
            "size": 13234,
            "upload_time": "2022-11-25T17:51:04",
            "upload_time_iso_8601": "2022-11-25T17:51:04.656536Z",
            "url": "https://files.pythonhosted.org/packages/91/5e/2a6680cbd5c8853d1483463ded4be93accfa623060e171123da1c5fbeecc/lirc-2.0.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2022-11-25 17:51:04",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "eugenetriguba",
    "github_project": "lirc",
    "travis_ci": false,
    "coveralls": true,
    "github_actions": true,
    "lcname": "lirc"
}
        
Elapsed time: 0.08777s