Skip to main content

Async, typed API client for Teltonika routers, built for Home Assistant

Project description

teltasync

teltasync is an async python library for interfacing with Teltonika routers via their HTTP API.

[!NOTE] Please report issues and open pull requests only at Codeberg: https://codeberg.org/dmho/teltasync

Installation

You can install the library using pip:

pip install teltasync

Usage

This is a simple example of how to use the library:

import asyncio

from teltasync import Teltasync


async def main():
    # Create client
    client = Teltasync(
        base_url="https://192.168.1.1/api",  # Full API URL
        username="admin",  # Admin username
        password="YOUR_PASSWORD",  # Admin password
        verify_ssl=False  # Most Teltonika devices use self-signed certs
    )

    try:
        # Get basic device info (no authentication required)
        device_info = await client.get_device_info()
        print(f"Device: {device_info.device_name} ({device_info.device_model})")

        # Validate credentials
        if await client.validate_credentials():
            print("Credentials are valid!")

            # Get detailed system information
            system_info = await client.get_system_info()
            print(f"Firmware version: {system_info.static.fw_version}")

            # Get modem status
            modems = await client.get_modem_status()
            for modem in modems:
                print(f"Modem {modem.id}: {modem.operator} ({modem.conntype})")
                print(f"  Signal: {modem.rssi} dBm")

        else:
            print("Invalid credentials!")

    finally:
        # Always close the session
        await client.close()


# Using as async context manager (recommended)
async def context_manager_example():
    async with Teltasync(
            base_url="https://192.168.1.1/api",
            username="admin",
            password="YOUR_PASSWORD",
            verify_ssl=False
    ) as client:
        device_info = await client.get_device_info()
        print(f"Device: {device_info.device_name}")
        # Session automatically closed when exiting context


# Run the example
if __name__ == "__main__":
    asyncio.run(main())

Supported Devices

Although it was currently only tested against a RUTX50, this library should work with most Teltonika routers that support the HTTP API, including:

  • RUT series (RUT240, etc.)
  • RUTX series (RUTX09, RUTX11, RUTX12, etc.)
  • TRB series gateways
  • Other Teltonika devices with HTTP API support

There are fixtures for a few other devices (RUT240, RUT241, RUT950, RUTX12, TRB140, TRB500), but no real-world testing against them was done yet.

Compatibility notes

Some Teltonika devices and firmware versions omit fields that are present on others. For example, older unauthenticated status responses may not include device_model or device_identifier, and some system/device/status responses may omit board.modems. These values are parsed as None, so downstream code should handle them as optional.

Requirements

  • Python 3.13+
  • aiohttp
  • pydantic

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

teltasync-0.3.1.tar.gz (18.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

teltasync-0.3.1-py3-none-any.whl (22.5 kB view details)

Uploaded Python 3

File details

Details for the file teltasync-0.3.1.tar.gz.

File metadata

  • Download URL: teltasync-0.3.1.tar.gz
  • Upload date:
  • Size: 18.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.13

File hashes

Hashes for teltasync-0.3.1.tar.gz
Algorithm Hash digest
SHA256 af3478fd20e88ca30a46f249cf8faefd3825194797310ba5f8dcde8dab6c77a6
MD5 e5b4605c7c67a3c3f46ce2ef7d88c0d1
BLAKE2b-256 17f34ce6f215bd5c3cb6c1dc76d077a09df9db2a755c5ebbc034ed449a448315

See more details on using hashes here.

File details

Details for the file teltasync-0.3.1-py3-none-any.whl.

File metadata

  • Download URL: teltasync-0.3.1-py3-none-any.whl
  • Upload date:
  • Size: 22.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.13

File hashes

Hashes for teltasync-0.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 0a8d4abf1af2e03620bde2404d69752631e845d057b439c7a7f9e8de0051390e
MD5 4f261fc69b22ce3b20a3c7974bd5614f
BLAKE2b-256 3e56304ebe182b61b1c37cb53546e9f36d41e90667343695a61a43e6fbeece3b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page