# teeheesmart
Python library for controlling a [TESmart][tesmart] media switch over a TCP
connection using their un-named [Hex protocol][hex].
It's primarily intended for use as a device driver for a [Home Assistant][ha]
integration.
## USAGE
```py
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][hsw1601], but
_should_ work for any TESmart switch using their [Hex protocol][hex].
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.
```sh
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`.
```sh
script/setup
```
### Tests
Run unit tests:
```sh
script/test
```
Tests can also be continuously run while developing with:
```sh
ptw .
```
### Build
To build distributables:
```sh
script/build
```
Build artifacts will be placed in the `dist` directory.
### Publishing
Build the distribution.
```sh
script/build
```
Publish the library to TestPyPI.
```sh
script/publish_test
```
Publish the library to PyPI.
```sh
script/publish
```
[ha]: https://www.home-assistant.io/
[tesmart]: https://www.tesmart.com/
[hex]: https://support.tesmart.com/hc/en-us/article_attachments/10269851662361
[hsw1601]: https://www.tesmart.com/collections/hdmi-switch/products/hsw1601-e23
Raw data
{
"_id": null,
"home_page": null,
"name": "teeheesmart",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.12",
"maintainer_email": null,
"keywords": "hdmi, home assistant, home automation, tesmart, video",
"author": null,
"author_email": "Kevin Rohrbaugh <code@rhrbgh.com>",
"download_url": "https://files.pythonhosted.org/packages/2a/cb/f604db82f64584ba5afc1219ccb5014d8fcf60c79d033c40099a835b7a4e/teeheesmart-0.9.0.tar.gz",
"platform": null,
"description": "# teeheesmart\n\nPython library for controlling a [TESmart][tesmart] media switch over a TCP\nconnection using their un-named [Hex protocol][hex].\n\nIt's primarily intended for use as a device driver for a [Home Assistant][ha]\nintegration.\n\n## USAGE\n\n```py\nfrom teeheesmart import get_media_switch\n\ndevice_url = '10.0.0.1'\nmedia_switch = get_media_switch(device_url)\n\nmedia_switch.select_source(3) # Change to input 3\nmedia_switch.update() # Refreshes device state\n```\n\nSee `src/teeheesmart/media_switch.py` for full `MediaSwitch` capabilities.\n\n### Device URL format\n\nThe URL takes the form of `<scheme>://<host>:<port>#<protocol>` with all\nbut `host` being optional.\n\nDefault scheme is `tcp`, with a default port of `5000`.\n\nDefault protocol is Hex (identifier: `hex`.)\n\nExamples:\n\n+ `10.0.0.1` ->\n Scheme: `tcp`, Host: `10.0.0.1`, Port: `5000`, Protocol: `hex`\n+ `localhost:1337` ->\n Scheme: `tcp`, Host: `localhost`, Port: `1337`, Protocol: `hex`\n+ `localhost:1337#hex` ->\n Scheme: `tcp`, Host: `localhost`, Port: `1337`, Protocol: `hex`\n+ `tcp://10.0.0.1` ->\n Scheme: `tcp`, Host: `10.0.0.1`, Port: `5000`, Protocol: `hex`\n+ `tcp://switch.local:8080` ->\n Scheme: `tcp`, Host: `switch.local`, Port: `8080`, Protocol: `hex`\n\n## Limitations\n\nThe library was tested and developed using a TESmart [HSW-1601][hsw1601], but\n_should_ work for any TESmart switch using their [Hex protocol][hex].\n\nIt does _not_ currently support:\n\n+ _Matrix_ switch operations, since I don't have a device to test with\n+ Serial communication, since TCP is the more likely control mechanism for home\nautomation purposes\n\nThe library has extension points for adding the support above should an\nopportunity or need to do so arise.\n\n## Development workflow\n\n### Python environment\n\nWorkflow scripts assume a working Python environment, including `pip`.\n\nRemember to be kind to yourself and use a virtual environment.\n\n```sh\npython3 -m venv env\nenv/bin/activate\n```\n\n### Setup\n\nInstall development and runtime dependencies. This also installs the library as an\neditable path, so that it can be loaded in the REPL and `pytest`.\n\n```sh\nscript/setup\n```\n\n### Tests\n\nRun unit tests:\n\n```sh\nscript/test\n```\n\nTests can also be continuously run while developing with:\n\n```sh\nptw .\n```\n\n### Build\n\nTo build distributables:\n\n```sh\nscript/build\n```\n\nBuild artifacts will be placed in the `dist` directory.\n\n### Publishing\n\nBuild the distribution.\n\n```sh\nscript/build\n```\n\nPublish the library to TestPyPI.\n\n```sh\nscript/publish_test\n```\n\nPublish the library to PyPI.\n\n```sh\nscript/publish\n```\n\n[ha]: https://www.home-assistant.io/\n[tesmart]: https://www.tesmart.com/\n[hex]: https://support.tesmart.com/hc/en-us/article_attachments/10269851662361\n[hsw1601]: https://www.tesmart.com/collections/hdmi-switch/products/hsw1601-e23\n",
"bugtrack_url": null,
"license": null,
"summary": "API for controlling a TESmart media switch using Hex protocol",
"version": "0.9.0",
"project_urls": {
"Bug Tracker": "https://github.com/krohrbaugh/teeheesmart/issues",
"Homepage": "https://github.com/krohrbaugh/teeheesmart"
},
"split_keywords": [
"hdmi",
" home assistant",
" home automation",
" tesmart",
" video"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "a96b8942d1678e116b0ef34e3a91ae754e1f4be533c4dc239eca856efb987d4d",
"md5": "c2b320eb65f26706d5da028e86720099",
"sha256": "3874bec8b54315f7112a0374d44e150b616d858173dbe4e998e2d05c13c78d6a"
},
"downloads": -1,
"filename": "teeheesmart-0.9.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "c2b320eb65f26706d5da028e86720099",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.12",
"size": 9776,
"upload_time": "2025-01-17T03:23:57",
"upload_time_iso_8601": "2025-01-17T03:23:57.868172Z",
"url": "https://files.pythonhosted.org/packages/a9/6b/8942d1678e116b0ef34e3a91ae754e1f4be533c4dc239eca856efb987d4d/teeheesmart-0.9.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "2acbf604db82f64584ba5afc1219ccb5014d8fcf60c79d033c40099a835b7a4e",
"md5": "145b7054f46beb86a93528609bb781d5",
"sha256": "6df9ff1ab32d70ad3f73899797a7332b27d437c981f83b8f36410bd79ae38b50"
},
"downloads": -1,
"filename": "teeheesmart-0.9.0.tar.gz",
"has_sig": false,
"md5_digest": "145b7054f46beb86a93528609bb781d5",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.12",
"size": 12343,
"upload_time": "2025-01-17T03:23:59",
"upload_time_iso_8601": "2025-01-17T03:23:59.982670Z",
"url": "https://files.pythonhosted.org/packages/2a/cb/f604db82f64584ba5afc1219ccb5014d8fcf60c79d033c40099a835b7a4e/teeheesmart-0.9.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-01-17 03:23:59",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "krohrbaugh",
"github_project": "teeheesmart",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"requirements": [],
"lcname": "teeheesmart"
}