Skip to main content

Zusi3 TCP Client library with async support and no deps

Project description

pyzusi3

Library to talk to Zusi3 without any specialized purpose.

Intentionally the message parameters are taken almost word-by-word from Zusi documentation to make using the lib easier. So be prepared for some mixing of code language (english) and zusi-lib language (german).

Examples

Minimal code example

import asyncio

async def print_state(client):
    while True:
        print(client.local_state)
        asyncio.sleep(1)

tasks = []
async def main(ip, port):
    client = ZusiClient(ip, port, "pyzusi3 demo", "1.0")
    client.request_status(displays=[
            messages.FAHRPULT_ANZEIGEN.GESCHWINDIGKEIT,
            messages.FAHRPULT_ANZEIGEN.STATUS_SIFA
        ],
        programdata=[
            messages.PROGRAMMDATEN.ZUGDATEI,
            messages.PROGRAMMDATEN.ZUGNUMMER
        ]
    )

    main_task = asyncio.create_task(client.connect())
    tasks.append(main_task)

    watch_task = asyncio.create_task(print_state(client))
    tasks.append(watch_task)

if __name__ == "__main__":
    run_loop = asyncio.new_event_loop()
    run_loop.create_task(main(ZUSI_IP, ZUSI_PORT))
    run_loop.run_forever()

Interaction simulation

see interactiondemo.py

PySide6 UI

ZusiData

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

pyzusi3-1.2.0.tar.gz (89.3 kB view details)

Uploaded Source

Built Distribution

pyzusi3-1.2.0-py3-none-any.whl (36.6 kB view details)

Uploaded Python 3

File details

Details for the file pyzusi3-1.2.0.tar.gz.

File metadata

  • Download URL: pyzusi3-1.2.0.tar.gz
  • Upload date:
  • Size: 89.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.1

File hashes

Hashes for pyzusi3-1.2.0.tar.gz
Algorithm Hash digest
SHA256 463e3f92f6f947576deba41d79bd7f110b913643c655263daec84105bc5e15ef
MD5 7e381fa3a97d19f0f1606bd5a51f96c0
BLAKE2b-256 3fe071c17b38dc6e9b648dbbbf5b69b52b81a2da2992ed7e0eed23a82ffe80ce

See more details on using hashes here.

File details

Details for the file pyzusi3-1.2.0-py3-none-any.whl.

File metadata

  • Download URL: pyzusi3-1.2.0-py3-none-any.whl
  • Upload date:
  • Size: 36.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.1

File hashes

Hashes for pyzusi3-1.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 327cbb8f3586cacddbc70ffa4f315c2a158050f4e7ab575ed4195afe14e53229
MD5 5357cfd047a54467eeb94eecbc734fa3
BLAKE2b-256 5962c46605d41b0bb701d3b415e3c2b95f2fb1829a839fada332b8471b5b6405

See more details on using hashes here.

Supported by

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