Skip to main content

API for controlling a TESmart media switch using Hex protocol

Project description

teeheesmart

Python library for controlling a TESmart media switch over a TCP connection using their un-named Hex protocol.

It's primarily intended for use as a device driver for a Home Assistant integration.

USAGE

from teeheesmart import get_media_switch

device_url = '10.0.0.1'
media_switch = get_media_switch(device_url)

media_switch.select_source(3) # Change to input 3
media_switch.update() # Refreshes device state

See src/teeheesmart/media_switch.py for full MediaSwitch capabilities.

Device URL format

The URL takes the form of <scheme>://<host>:<port>#<protocol> with all but host being optional.

Default scheme is tcp, with a default port of 5000.

Default protocol is Hex (identifier: hex.)

Examples:

  • 10.0.0.1 -> Scheme: tcp, Host: 10.0.0.1, Port: 5000, Protocol: hex
  • localhost:1337 -> Scheme: tcp, Host: localhost, Port: 1337, Protocol: hex
  • localhost:1337#hex -> Scheme: tcp, Host: localhost, Port: 1337, Protocol: hex
  • tcp://10.0.0.1 -> Scheme: tcp, Host: 10.0.0.1, Port: 5000, Protocol: hex
  • tcp://switch.local:8080 -> Scheme: tcp, Host: switch.local, Port: 8080, Protocol: hex

Limitations

The library was tested and developed using a TESmart HSW-1601, but should work for any TESmart switch using their Hex protocol.

It does not currently support:

  • Matrix switch operations, since I don't have a device to test with
  • Serial communication, since TCP is the more likely control mechanism for home automation purposes

The library has extension points for adding the support above should an opportunity or need to do so arise.

Development workflow

Python environment

Workflow scripts assume a working Python environment, including pip.

Remember to be kind to yourself and use a virtual environment.

python3 -m venv env
env/bin/activate

Setup

Install development and runtime dependencies. This also installs the library as an editable path, so that it can be loaded in the REPL and pytest.

script/setup

Tests

Run unit tests:

script/test

Tests can also be continuously run while developing with:

ptw .

Build

To build distributables:

script/build

Build artifacts will be placed in the dist directory.

Publishing

Build the distribution.

script/build

Publish the library to TestPyPI.

script/publish_test

Publish the library to PyPI.

script/publish

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

teeheesmart-0.9.0.tar.gz (12.3 kB view details)

Uploaded Source

Built Distribution

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

teeheesmart-0.9.0-py3-none-any.whl (9.8 kB view details)

Uploaded Python 3

File details

Details for the file teeheesmart-0.9.0.tar.gz.

File metadata

  • Download URL: teeheesmart-0.9.0.tar.gz
  • Upload date:
  • Size: 12.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.12.8

File hashes

Hashes for teeheesmart-0.9.0.tar.gz
Algorithm Hash digest
SHA256 6df9ff1ab32d70ad3f73899797a7332b27d437c981f83b8f36410bd79ae38b50
MD5 145b7054f46beb86a93528609bb781d5
BLAKE2b-256 2acbf604db82f64584ba5afc1219ccb5014d8fcf60c79d033c40099a835b7a4e

See more details on using hashes here.

File details

Details for the file teeheesmart-0.9.0-py3-none-any.whl.

File metadata

  • Download URL: teeheesmart-0.9.0-py3-none-any.whl
  • Upload date:
  • Size: 9.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.12.8

File hashes

Hashes for teeheesmart-0.9.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3874bec8b54315f7112a0374d44e150b616d858173dbe4e998e2d05c13c78d6a
MD5 c2b320eb65f26706d5da028e86720099
BLAKE2b-256 a96b8942d1678e116b0ef34e3a91ae754e1f4be533c4dc239eca856efb987d4d

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