{"id":14978085,"url":"https://github.com/markusressel/raspyrfm-client","last_synced_at":"2025-10-28T08:31:41.741Z","repository":{"id":18422397,"uuid":"84258686","full_name":"markusressel/raspyrfm-client","owner":"markusressel","description":"A python library to send rc signals with the RaspyRFM module","archived":false,"fork":false,"pushed_at":"2023-02-11T23:56:23.000Z","size":170,"stargazers_count":5,"open_issues_count":0,"forks_count":4,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-02-01T12:51:16.819Z","etag":null,"topics":["433mhz","home-automation","homeassistant","python-library","raspberry-pi-3","raspberrypi","raspy-rfm","raspyrfm"],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/markusressel.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":"2017-03-08T00:04:09.000Z","updated_at":"2023-11-11T04:53:00.000Z","dependencies_parsed_at":"2024-06-21T15:36:09.080Z","dependency_job_id":null,"html_url":"https://github.com/markusressel/raspyrfm-client","commit_stats":{"total_commits":131,"total_committers":6,"mean_commits":"21.833333333333332","dds":"0.22137404580152675","last_synced_commit":"96af67353cea4fe67fdb437036167f5fb9cdaa71"},"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/markusressel%2Fraspyrfm-client","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/markusressel%2Fraspyrfm-client/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/markusressel%2Fraspyrfm-client/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/markusressel%2Fraspyrfm-client/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/markusressel","download_url":"https://codeload.github.com/markusressel/raspyrfm-client/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":238623081,"owners_count":19502979,"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":["433mhz","home-automation","homeassistant","python-library","raspberry-pi-3","raspberrypi","raspy-rfm","raspyrfm"],"created_at":"2024-09-24T13:56:50.605Z","updated_at":"2025-10-28T08:31:41.293Z","avatar_url":"https://github.com/markusressel.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":".. |pypi_version| image:: https://badge.fury.io/py/raspyrfm-client.svg\n    :target: https://badge.fury.io/py/raspyrfm-client\n\nraspyrfm-client |pypi_version|\n==============================\n\nA python 3.4+ library that allows the generation of network codes for the RaspyRFM rc module (and other gateways too!).\n\nBuild Status\n============\n\n.. |build_master| image:: https://travis-ci.org/markusressel/raspyrfm-client.svg?branch=master\n    :target: https://travis-ci.org/markusressel/raspyrfm-client/branches\n\n.. |build_beta| image:: https://travis-ci.org/markusressel/raspyrfm-client.svg?branch=beta\n    :target: https://travis-ci.org/markusressel/raspyrfm-client/branches\n\n.. |build_dev| image:: https://travis-ci.org/markusressel/raspyrfm-client.svg?branch=dev\n    :target: https://travis-ci.org/markusressel/raspyrfm-client/branches\n\n\n.. |codebeat_master| image:: https://codebeat.co/badges/fcac9cfe-b6a2-4c4a-938d-42214371dc3d\n    :target: https://codebeat.co/projects/github-com-markusressel-raspyrfm-client-master\n\n.. |codebeat_beta| image:: https://codebeat.co/badges/c6c09759-3f34-4a16-b17e-d7989b3f7fae\n    :target: https://codebeat.co/projects/github-com-markusressel-xs1-api-client-beta\n\n.. |codebeat_dev| image:: https://codebeat.co/badges/6ef4cbdd-a452-45b2-8ee8-f7a09e53689f\n    :target: https://codebeat.co/projects/github-com-markusressel-raspyrfm-client-dev\n\n+--------------------+------------------+-----------------+\n| Master             | Beta             | Dev             |\n+====================+==================+=================+\n| |build_master|     | |build_beta|     | |build_dev|     |\n+--------------------+------------------+-----------------+\n| |codebeat_master|  | |codebeat_beta|  | |codebeat_dev|  |\n+--------------------+------------------+-----------------+\n\nHome Assistant\n==============\nThe initial goal of this library was to be able to integrate the SimpleSolutions ConnAir gateway with `Home Assistant \u003chttps://www.home-assistant.io\u003e`_. This gateway is sadly not sold anymore but there are other alternatives like the Intertechno Gateway or the `ConnAir Emulator script \u003chttps://github.com/Phunkafizer/RaspyRFM/blob/master/connair.py\u003e`_ that can be used on a Raspberry Pi equipped with a 433MHz radio like the `RaspyRFM from Seegel Systeme \u003chttps://www.seegel-systeme.de/produkt/raspyrfm-ii/\u003e`_.\n\nYou can find the related integration documentation here: \n`RaspyRFM Home Assistant component documentation \u003chttps://www.home-assistant.io/components/switch.raspyrfm/\u003e`_\n\nHow to use\n==========\n\nInstallation\n------------\n\n:code:`pip install raspyrfm-client`\n\nUsage\n-----\n\nFor a basic example have a look at the `example.py \u003chttps://github.com/markusressel/raspyrfm-client/blob/master/example_simple.py\u003e`_ file.\n\nIf you need more info have a look at the `documentation \u003chttp://raspyrfm-client.readthedocs.io/\u003e`_ which should help.\n\nBasic Example\n-------------\nImport required modules\n^^^^^^^^^^^^^^^^^^^^^^^\n.. code-block:: python\n\n   from raspyrfm_client import RaspyRFMClient\n   from raspyrfm_client.device_implementations.controlunit.actions import Action\n   from raspyrfm_client.device_implementations.controlunit.controlunit_constants import ControlUnitModel\n   from raspyrfm_client.device_implementations.gateway.manufacturer.gateway_constants import GatewayModel\n   from raspyrfm_client.device_implementations.manufacturer_constants import Manufacturer\n\n\nCreate the :code:`RaspyRFMClient` object\n^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\nGet a client instance by calling:\n\n\n.. code-block:: python\n\n   rfm_client = RaspyRFMClient()\n\nCreate a :code:`Gateway` instance\n^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\nYou can let the library search automatically for gateways available in LAN using:\n\n.. code-block:: python\n\n   gateways = rfm_client.search()\n\nThis will return a list of Gateways that can later be used to send signals to.\n\nTo get a quick overview of what gateway **manufacturers** and **models** are supported call:\n\n.. code-block:: python\n\n   rfm_client.list_supported_gateways()\n\nCreate a gateway instance with the specified :code:`IP` and :code:`Port` of your Gateway by using:\n\n.. code-block:: python\n\n   gateway = rfm_client.get_gateway(Manufacturer.SEEGEL_SYSTEME, GatewayModel.RASPYRFM, \"192.168.2.10\", 9876)\n\nor\n\n.. code-block:: python\n\n   gateway = rfm_client.get_gateway(Manufacturer.SEEGEL_SYSTEME, GatewayModel.RASPYRFM, \"192.168.2.10\") # defaults to 49880 or the gateway implementations default\n\nGet a :code:`ControlUnit`\n^^^^^^^^^^^^^^^^^^^^^^^^^\nControlUnits are the devices that receive the RC signals sent using the gateway, f.ex. a power outlet.\n\nTo get a quick overview of what ControlUnits **manufacturers** and **models** are supported call:\n\n.. code-block:: python\n\n   rfm_client.list_supported_controlunits()\n\nwhich will give you an indented list of supported manufacturers and their supported models similar to this:\n\n.. code-block:: text\n\n   Elro\n     RC3500-A IP44 DE\n     AB440S\n     AB440D 200W\n     AB440D 300W\n     AB440ID\n     AB440IS\n     AB440L\n     AB440SC\n     AB440WD\n   BAT\n     RC AAA1000-A IP44 Outdoor\n   Brennenstuhl\n     RCS 1000 N Comfort\n     RCS 1044 N Comfort\n   Intertek\n     Model 1919361\n   [...]\n\nTo generate codes for a device **you first have to get an instance of its implementation** like this:\n\n.. code-block:: python\n\n   brennenstuhl_rcs1000 = rfm_client.get_controlunit(manufacturer_constants.BRENNENSTUHL,\n                                             manufacturer_constants.RCS_1000_N_COMFORT)\n\nThe parameters of the :code:`get_controlunit()` method always need to be an enum value of the specified type.\nYou can get an enum constant by its name though using:\n\n.. code-block:: python\n\n   manufacturer = Manufacturer(\"Intertechno\")\n   model = ControlUnitModel(\"IT-1500\")\n\n:code:`ControlUnit` channel configuration\n^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\nBefore you can generate codes with your shiny new gateway and :code:`ControlUnit` implementations you have to specify a channel configuration for your :code:`ControlUnit`. These **configurations can be very different for every device**. The best way to know the correct way of specifying the channel configuration for a specific device is to look at the source code (yes I know...) or by trial and error (even worse). A good :code:`ControlUnit` implementation should tell you how the configuration should look like when specifying it in a wrong way.\n\nHowever all configurations are a **keyed dictionary**.\nSo in general there are two ways of passing the channel configuration argument.\nOne (inline):\n\n.. code-block:: python\n\n    device.set_channel_config(value1=1, value2=2)\n\nTwo (as a dictionary):\n\n.. code-block:: python\n\n    device.set_channel_config(**{\n        'value1': 1,\n        'value2': 2\n    })\n\n**Note** that the **keys always need to be a** :code:`string`.\nThe second one is the recommended one as it will often result in a much more readable source code.\n\nFor our Brennenstuhl device it would look like this:\n\n.. code-block:: python\n\n    brennenstuhl_rcs1000.set_channel_config(**{\n        '1': True,\n        '2': True,\n        '3': True,\n        '4': True,\n        '5': True,\n        'CH': 'A'\n    })\n\nGenerate action codes\n^^^^^^^^^^^^^^^^^^^^^\nNow that you have a properly set up :code:`ControlUnit` you can generate codes for it's supported actions by using an :code:`Action` enum constant that you imported previously.\n\nTo get a list of supported actions for a :code:`ControlUnit` call:\n\n.. code-block:: python\n\n   brennenstuhl_rcs1000.get_supported_actions()\n\nand generate a code for one of them using your :code:`Gateway` instance:\n\n.. code-block:: python\n\n   code = gateway.generate_code(brennenstuhl_rcs1000, Action.ON)\n\nSend the code to the :code:`RaspyRFM` module\n^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\nTo send a code for your device of choice you can combine the objects in this call:\n\n.. code-block:: python\n\n   rfm_client.send(gateway, brennenstuhl_rcs1000, Action.ON)\n\nThis will generate a code specific to the passed in gateway implementation and send it to it's host address immediately after.\n\nCustom implementations\n======================\n\nThe :code:`raspyrfm-client` library is designed so you can implement custom devices in a (hopefully) very easy way.\n\nFile Structure\n--------------\nAll :code:`ControlUnit` implementations are located in the :code:`/device_implementations/controlunit/manufacturer/` module and implement the base class :code:`Device` that can be found in :code:`/device_implementations/controlunit/base.py`.\n\nCreate a new :code:`ControlUnit`\n--------------------------------\nTo create a new :code:`ControlUnit` implementation for a new manufacturer and model create a new subdirectory for your manufacturer and a python file for your model:\n\n.. code-block::\n\n    ───raspyrfm_client\n    │   │   client.py\n    │   │\n    │   └───device\n    │       │   actions.py\n    │       │   base.py\n    │       │\n    │       └───manufacturer\n    │           │   manufacturer_constants.py\n    │           │\n    │           ├───intertek\n    │           │       Model1919361.py\n    │           │\n    │           ├───rev\n    │           │       Ritter.py\n    │           │       Telecontrol.py\n    │           │\n    │           ├───universal\n    │           │       HX2262Compatible.py\n    │           │\n    │           └───yourmanufacturer\n    │                   yourmodel.py\n    ──────────────────────────────────────────\n\nImplement a :code:`ControlUnit`\n-------------------------------\n\nNow the basic implementation of your :code:`ControlUnit` should looks like this:\n\n.. code-block:: python\n\n    from raspyrfm_client.device_implementations.controlunit.actions import Action\n    from raspyrfm_client.device_implementations.controlunit.base import ControlUnit\n\n\n    class YourModel(ControlUnit):\n        def __init__(self):\n            from raspyrfm_client.device_implementations.manufacturer_constants import Manufacturer\n            from raspyrfm_client.device_implementations.controlunit.controlunit_constants import ControlUnitModel\n            super().__init__(Manufacturer.YourManufacturer, ControlUnitModel.YourModel)\n\n        def get_channel_config_args(self):\n            return {}\n\n        def get_pulse_data(self, action: Action):\n            return [[0, 0], [0, 0]], 0, 0\n\n        def get_supported_actions(self) -\u003e [str]:\n            return [Action.ON]\n\n\nMost importantly you have to call the :code:`super().__init__` method like shown. This will ensure that your implementation is found by the :code:`RaspyRFMClient` and you can get an instance of your device using :code:`rfm_client.get_controlunit()` as shown before.\n\nIf your manufacturer does not exist yet **create a new enum constant** in the :code:`manufacturer_constants.py` file and use its value in your :code:`__init__`.\n**Do the same thing for your model name** in the :code:`controlunit_constants.py` file.\n\nYou also have to implement all abstract methods from the :code:`Device` class. Have a look at it's documentation to get a sense of what those methods are all about.\n\nAfter you have implemented all methods you are good to go!\nJust call :code:`rfm_client.reload_implementation_classes()` and :code:`rfm_client.list_supported_controlunits()` to check if your implementation is listed.\nIf everything looks good you can use your implementation like any other one.\n\n\n\nExclude a WIP implementation\n----------------------------\nTo prevent the RaspyRFM client from importing your half baked or base class implementation just include a class field like this:\n\n.. code-block:: python\n\n   class YourModel(ControlUnit):\n      DISABLED = True\n\n      [...]\n\nContributing\n============\n\nGitHub is for social coding: if you want to write code, I encourage contributions through pull requests from forks\nof this repository. Create GitHub tickets for bugs and new features and comment on the ones that you are interested in.\n\nLicense\n=======\n\n::\n\n    raspyrfm-client by Markus Ressel\n    Copyright (C) 2017  Markus Ressel\n\n    This program is free software: you can redistribute it and/or modify\n    it under the terms of the GNU General Public License as published by\n    the Free Software Foundation, either version 3 of the License, or\n    (at your option) any later version.\n\n    This program is distributed in the hope that it will be useful,\n    but WITHOUT ANY WARRANTY; without even the implied warranty of\n    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n    GNU General Public License for more details.\n\n    You should have received a copy of the GNU General Public License\n    along with this program.  If not, see \u003chttp://www.gnu.org/licenses/\u003e.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarkusressel%2Fraspyrfm-client","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmarkusressel%2Fraspyrfm-client","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarkusressel%2Fraspyrfm-client/lists"}