Skip to main content

Zusi3 TCP Client library with async support and no deps

Project description

WARNING

Zusi 3.5 introduced breaking changes without increasing API version, so ensure to use pyzusi 1.2.1 for Zusi 3.4 and below

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-2.0.0.tar.gz (91.4 kB view details)

Uploaded Source

Built Distribution

pyzusi3-2.0.0-py3-none-any.whl (37.9 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for pyzusi3-2.0.0.tar.gz
Algorithm Hash digest
SHA256 aac7e20f41929d5ed2d69825fd88d93c5ddefb8592c6430784a70dd83422440e
MD5 329ea57e8c7503174e99803bb1aefb84
BLAKE2b-256 36cb077940847196ddc5b6ed6f7b16ba6e250408f8f6aa1e7e29dc1a4fed0f32

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for pyzusi3-2.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b9921b8ed6c7aa93dce8985c7de4082c6286dba49d0bf24af87b0e8fe59a57c1
MD5 cb59445b665ccb15ddc616f944baab37
BLAKE2b-256 bc560bc36023c4b4542fe2a8801fe2314e89f94dc8b2b1ef41b14e0151b91f2f

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