{"id":21634515,"url":"https://github.com/arceryz/atlib","last_synced_at":"2025-04-11T15:30:44.067Z","repository":{"id":62324585,"uuid":"559639095","full_name":"arceryz/ATlib","owner":"arceryz","description":"Send and receive SMS/texts using Python. Low and high level API for sending AT commands over serial bus. Tested with SIM800L.","archived":false,"fork":false,"pushed_at":"2025-01-18T04:20:54.000Z","size":30,"stargazers_count":9,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-25T11:39:10.457Z","etag":null,"topics":["atcommands","pyserial","python","python-library","raspberry-pi","serial","sim800l","sms","sms-api","texting"],"latest_commit_sha":null,"homepage":"","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/arceryz.png","metadata":{"files":{"readme":"README.md","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}},"created_at":"2022-10-30T18:23:55.000Z","updated_at":"2025-03-18T16:04:47.000Z","dependencies_parsed_at":"2023-01-26T07:50:13.014Z","dependency_job_id":null,"html_url":"https://github.com/arceryz/ATlib","commit_stats":null,"previous_names":["kairature/atlib","arceryz/atlib"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arceryz%2FATlib","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arceryz%2FATlib/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arceryz%2FATlib/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arceryz%2FATlib/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/arceryz","download_url":"https://codeload.github.com/arceryz/ATlib/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248431244,"owners_count":21102163,"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":["atcommands","pyserial","python","python-library","raspberry-pi","serial","sim800l","sms","sms-api","texting"],"created_at":"2024-11-25T03:16:58.689Z","updated_at":"2025-04-11T15:30:44.056Z","avatar_url":"https://github.com/arceryz.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ATlib\nPython library for sending and receiving SMS texts using AT commands. Higher and lower level features supported. Tested with SIM800L.\n\nThe API is relatively straightforward. The API is not asynchronous meaning all methods return the result directly.\nTake a look at [atlib.py](/atlib.py) for the full library.\n\nFor an application of this library, see [gsm-agent](https://github.com/swordstrike1/gsm-agent). Where SMS messages can\nused to run shell scripts on a server (with security checks \u0026 registration).\n\n# API\n\nThe API features two classes for interfacing with the GSM modem.\n\nThe low level is the AT_Device class.\nThis class exposes only a synchronous API for sending AT commands and reading responses. It abstracts\nthe painful process of AT commands not directly responding due to latency. Responses are detected by a\nterminated OK or ERROR string. The `read()` commands returns a tokenized list of the reply for easy parsing.\n- Opening serial connection.\n- Synchronizing baudrate using `sync_baudrate()` (by sending \"AT\" and awaiting response).\n- Sending AT commands.\n- Reading AT commands reliably.\n- Detecting errors.\n\nThe high level is the GSM_Device class. This class inherits from AT_Device.\nThis class provides higher level features such as\n- Unlocking the device sim using pin.\n- Sending text messages.\n- Reading text messages (by category unread, all, read, etc).\n\nThis is still a w.i.p class for my personal use cases. Might be extended with call support later on.\n\n# Contributing\n\nIf you have problems with your modem, you can open issues here. I have tested all commands with\na properly hooked up SIM800L on a Raspberry Pi Bullseye. Know that not all devices support\nall AT commands, and therefore may fail when using this library. However most devices should support\nthe basics.\n\n# Examples\n\nA minimal example can be found in [/examples](/examples) directory. Refer to the library\nitself to see many AT commands in action already (e.g sending commands, checking responses).\nSee below for a minimal texting application:\n\n```python\n#!/bin/python\n# Console SMS sender using ATlib.\n\nfrom atlib import *\n\n# Show debug logs\nimport logging\nlogging.basicConfig(level=logging.DEBUG)\n\ngsm = GSM_Device(\"/dev/serial0\")\nif gsm.is_sim_locked():\n    pin = input(\"SIM Pin: \")\n    gsm.unlock_sim(pin)\nelse:\n    print(\"SIM already unlocked.\")\n\nwhile True:\n    print(\"\")\n    nr = input(\"Phone number: \")\n    msg = input(\"Message: \")\n\n    if gsm.send_sms(nr, msg) != OK:\n        print(\"Error sending message.\")\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farceryz%2Fatlib","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Farceryz%2Fatlib","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farceryz%2Fatlib/lists"}