Skip to main content

A Python client for LAN communications with Tewke devices

Project description

ci

pytewke

A Python client for local CoAP communications with Tewke devices

This library is under development

Usage

Install

pip install pytewke

Examples

Discovering Scenes and Targets

import asyncio
from pprint import pprint

from pytewke import Tap
from pytewke.error import PyTewkeDiscoveryError


async def test_device():
    """Test Tap Panel device."""
    # Replace with your device's IP address
    host = "w.x.y.z"

    try:
        async with Tap(host) as tap:
            print("Targets:")
            targets = await tap.get_targets()
            pprint(targets)

            print("Scenes:")
            scenes = await tap.get_scenes()
            pprint(scenes)
    except PyTewkeDiscoveryError as err:
        print(f"Error connecting to {host}, error: {repr(err)}")


if __name__ == "__main__":
    asyncio.run(test_device())

Example script

The repository includes an example script to quickly try it out.

Uncomment the relevant lines in example.py to run different examples like discovering resources, reading config, observing state, etc.

python3 example.py

Note: if you have not installed pytewke but have cloned the library instead, you will need to add the src folder to your PYTHONPATH:

PYTHONPATH="${PYTHONPATH}:/path/to/pytewke/src" python3 example.py

Development

Requirements

  • aiocoap
  • cbor2
  • pydantic

Note: Python versions older than 3.12 have not been tested.

Development requirements

Run the following command inside this folder

pip install .[dev]

Note: You will need to add the src folder to your PYTHONPATH when using the example script or while running tests.

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

pytewke-0.5.1.tar.gz (36.2 MB view details)

Uploaded Source

Built Distribution

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

pytewke-0.5.1-py3-none-any.whl (24.5 kB view details)

Uploaded Python 3

File details

Details for the file pytewke-0.5.1.tar.gz.

File metadata

  • Download URL: pytewke-0.5.1.tar.gz
  • Upload date:
  • Size: 36.2 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.2.0 CPython/3.14.5

File hashes

Hashes for pytewke-0.5.1.tar.gz
Algorithm Hash digest
SHA256 b2283bf7dd4f0e70fe5ac6f0df79e107f23e8e6a93c8f21a75e44236f2b49a8b
MD5 915474110f244ec8450b8791440aca3f
BLAKE2b-256 15e0cb053aa0e808d0de4a5d2667062a75f783a5f9f59e2ff53ae2d7111e7126

See more details on using hashes here.

File details

Details for the file pytewke-0.5.1-py3-none-any.whl.

File metadata

  • Download URL: pytewke-0.5.1-py3-none-any.whl
  • Upload date:
  • Size: 24.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.2.0 CPython/3.14.5

File hashes

Hashes for pytewke-0.5.1-py3-none-any.whl
Algorithm Hash digest
SHA256 59b5e263becb3814e8409af2bb31fba82623a7243e051aa7fe5bafb9fce73a98
MD5 f0b9187a89af7c0771504732b93f9e71
BLAKE2b-256 c7379cd9c0b369c16a0ff666efe1a846825447ee70686d1571906a84b2211f5f

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