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.
Metadata
Release files for pytewke 0.6.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| pytewke-0.6.1.tar.gz | 17.3 MB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pytewke-0.6.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 17.3 MB
Release files / pytewke-0.6.1.tar.gz
| Download URL | pytewke-0.6.1.tar.gz |
|---|---|
| Size | 17.3 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
54e7461cec88294a0fbdf35acec0ef8bf96c6819607770bda4b23794dc9a3ab6
|
|
BLAKE2b-256 checksum How to use checksums |
7585765803e0886173db251f29d23b4882b62af59f84814e397c970598e2c206
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.14.6
|
Release files / pytewke-0.6.1-py3-none-any.whl
| Download URL | pytewke-0.6.1-py3-none-any.whl |
|---|---|
| Size | 26.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e717411ea4f8a622ce6941ff6e54b44f9c7deee606ab133c500da7d4f47a5bfc
|
|
BLAKE2b-256 checksum How to use checksums |
c1de53ca7b412e3683f151796b1f6d9a8d4d6518fb57a8ec22a4fe2d4bf7311f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.14.6
|