{"id":20989161,"url":"https://github.com/latchdevel/pypicode","last_synced_at":"2026-04-22T12:33:16.565Z","repository":{"id":223114925,"uuid":"759353607","full_name":"latchdevel/pyPiCode","owner":"latchdevel","description":"Python C extension module to wrap the PiCode library","archived":false,"fork":false,"pushed_at":"2024-04-14T10:34:49.000Z","size":54,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-04-14T12:38:11.710Z","etag":null,"topics":["cmake","extension","module","package","picode","picoder","pilight","swig","wrap","wrapper"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"lgpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/latchdevel.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","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":"2024-02-18T11:07:14.000Z","updated_at":"2024-04-14T12:38:11.711Z","dependencies_parsed_at":"2024-11-19T06:40:24.753Z","dependency_job_id":null,"html_url":"https://github.com/latchdevel/pyPiCode","commit_stats":null,"previous_names":["latchdevel/pypicode"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/latchdevel%2FpyPiCode","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/latchdevel%2FpyPiCode/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/latchdevel%2FpyPiCode/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/latchdevel%2FpyPiCode/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/latchdevel","download_url":"https://codeload.github.com/latchdevel/pyPiCode/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243401482,"owners_count":20285051,"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":["cmake","extension","module","package","picode","picoder","pilight","swig","wrap","wrapper"],"created_at":"2024-11-19T06:23:59.970Z","updated_at":"2025-12-27T16:03:36.462Z","avatar_url":"https://github.com/latchdevel.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# pyPiCode\nPython C extension module to wrap the PiCode library.\n\n[![License: LGPL v3](https://img.shields.io/badge/License-LGPL%20v3-blue.svg)](https://www.gnu.org/licenses/lgpl-3.0)\n\nThe [**PiCode library**](http://github.com/latchdevel/PiCode) provides an easy way to handle the wireless protocols of weather stations and radio control switches using 315Mhz/433Mhz radio frequency in ASK/OOK modulation, which have been implemented by the [**\"pilight\"** project](https://manual.pilight.org/protocols/433.92/index.html)\n\nThe PiCode library is a standard C/C++ library, both static and dynamic, that works on any libc/libc++ compatible system, such as macOS, FreeBSD, Linux, and even Windows.\n\nUsing [SWIG](https://www.swig.org/), to generate the Python C extension source files that wraps PiCode's static C library:\n- [**picode_wrap.c**](picode_wrap.c): CMake compiles the C source file, as does the PiCode library, and they link together to build the Python C extension module.\n- [**picode_wrap.py**](pypicode/picode_wrap.py): Python functions of the picode wrapper module are redefined to add basic docstrings and parameter checks in [**__init__.py**](pypicode/__init__.py) package file.\n\n## Install\nPackage installation builds the C extension module, so some OS tools are required like these packages on Debian-based Linux systems:\n- Python3 development tools: `python3-dev`\n- Python3 package installer: `python3-pip`\n- C compiler suite: `build-essential`\n- CMake make system: `cmake`\n- Git version control system: `git`\n\nCommand to install from GitHub:\n```\n$ python3 -m pip install -v --user git+https://github.com/latchdevel/pyPiCode.git\n```\n\n## Tests\nPyPiCode provides a unit tests module to verify its correct operation:\n```\n$ python3 -m unittest discover -v pypicode\n```\n\n## Usage\n```python\n\u003e\u003e\u003e import pypicode as picode\n\u003e\u003e\u003e\n\u003e\u003e\u003e picode.decodeString(\"c:011010100101011010100110101001100110010101100110101010101010101012;p:1400,600,6800@\")\n{'protocols': [{'conrad_rsl_switch': {'id': 1, 'unit': 2, 'state': 'on'}}]}\n\u003e\u003e\u003e\n```\n\n## Functions:\n\n+ **`decodePulseTrain(pulses_list: list)`**\n\n    Decodes a list of pulses to a results dict.\n\n    Returns a dict always, with a key \"protocols\" and a list of decoded protocols as its value,\n    which will be empty if none are decoded, like as { 'protocols': [ ] }\n\n+ **`decodeString(pilight_string: str)`**\n  \n    Decodes a string in pilight format to a results dict.\n\n    Returns a dict with a key \"protocols\" and a list of decoded protocols as its value, or None on failure.\n\n+ **`encodeJson(json: dict, repeats: int = 0)`**\n\n    Encodes a full json dict to a string in pilight format.\n\n    Returns a pilight string or None on failure.\n\n+ **`encodeToPulseTrain(protocol, json_data: dict)`**\n\n    Encodes a Swig Object of type 'protocol_t *' and a json data dict to a pulses list.\n\n    Returns a pulses list or None on failure.\n\n+ **`encodeToPulseTrainByName(protocol_name: str, json_data: dict)`**\n\n    Encodes a protocol name string and a json data dict to a pulses list.\n\n    Returns a pulses list or None on failure.\n\n+ **`encodeToString(protocol_name: str, json_data: dict, repeats: int = 0)`**\n\n    Encodes a protocol name string and a json data dict to a string in pilight format.\n\n    Returns a pilight string or None on failure.\n\n+ **`findProtocol(name: str)`**\n\n    Find a protocol among all those initialized by name.\n\n    Returns a Swig Object of type 'protocol_t *' or None on failure.\n\n+ **`getPiCodeVersion()`**\n\n    Get version of PiCode library.\n\n    Returns the full version string of the PiCode library or None on failure.\n\n+ **`pulseTrainToString(pulses_list: list, repeats: int = 0)`**\n\n    Converts a list of pulses to a string in pilight format.\n\n    Returns a pilight string or None on failure.\n\n+ **`stringToPulseTrain(pilight_string: str)`**\n\n    Converts a string in pilight format to a pulses lists.\n    \n    Returns a pulses list or None on failure.\n\n\n# License\nCopyright (c) 2021-2022 Jorge Rivera. All right reserved.\n\nLicense GNU Lesser General Public License v3.0.\n\nThis program is free software; you can redistribute it and/or\nmodify it under the terms of the GNU Lesser General Public\nLicense as published by the Free Software Foundation; either\nversion 3 of the License, or (at your option) any later version.\n\nThis program is distributed in the hope that it will be useful,\nbut WITHOUT ANY WARRANTY; without even the implied warranty of\nMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\nLesser General Public License for more details.\n\nYou should have received a copy of the GNU Lesser General Public License\nalong with this program; if not, write to the Free Software Foundation,\nInc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.\n\nSee the [LICENSE](LICENSE.txt) file for license rights and limitations (lgpl-3.0).","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flatchdevel%2Fpypicode","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flatchdevel%2Fpypicode","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flatchdevel%2Fpypicode/lists"}