Metadata-Version: 2.1
Name: meshcatstic
Version: 0.1.3
Summary: Meshtastic serial device discovery gateway service and client built around socat plus other tooling
License: GNU GPLv3
Author: Ben Meadors
Author-email: benmmeadors@gmail.com
Requires-Python: >=3.10,<3.13
Classifier: License :: Other/Proprietary License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Requires-Dist: adafruit-nrfutil (>=0.5.3.post16,<0.6.0)
Requires-Dist: colorama (>=0.4.6,<0.5.0)
Requires-Dist: esptool (>=4.8.1,<5.0.0)
Requires-Dist: fastapi (>=0.115.1,<0.116.0)
Requires-Dist: meshtastic (>=2.5.1,<3.0.0)
Requires-Dist: pyserial (>=3.5,<4.0)
Requires-Dist: python-multipart (>=0.0.12,<0.0.13)
Requires-Dist: typer (>=0.12.5,<0.13.0)
Requires-Dist: uvicorn (>=0.31.1,<0.32.0)
Description-Content-Type: text/markdown

# MeshCat (Meshcatstic)

Meshtastic serial device discovery gateway service and cli client built around `socat` and other tooling

![MeshCat Logo](meshcat.svg)

## Requirements

- Posix environment (tested with Ubunutu)
- Python 3.10+ and Poetry (for development)
- socat (`sudo apt install socat`)
- Uvicorn server (comes with pypi installation or poetry install)
- `pipx install meshcatstic`

## Running for development

## Server

- Clone the repository
- Install dependencies with `poetry install`
- Run the service with `poetry run start`

### Endpoints

- `GET /list`: List all connected Meshtastic serial devices.
- `POST /connect?port=/dev/ttymythang`: Initiate a socat server for the client connect to a meshtastic serial device on `/dev/ttymythang`. Should be unecessary to initiate manually, as background service handles this.
- `POST /update?port=/dev/ttymythang`: Flash device with uploaded binary on selected port
- `POST /stop?port=/dev/ttymythang`: Kill socat process on port

## Client

> **Warning**: Requires running with `sudo` because `socat` is creating virtual ports.

- Clone the repository
- Install dependencies with `sudo poetry install`
- Set environment variable with the remote host `MESHCAT_HOST="meshcathostname"`
- List devices on the remote service with `poetry run meshcat list`
- Connect to a device on the remote service with `poetry run meshcat connect /dev/ttyACM0`
- Take the generated TCP portnum for the gateway serial device and use meshtastic cli or any other client to connect to port `/tmp/meshcat{tcpportnum}`
- To update (flash) a remote device on the service, `poetry run meshcat flash /dev/ttymythang firmware-mythang-update.bin`


## Running

After pip installing `meshcatstic`, you can run both the server and client.

To run the server using uvicorn: `uvicorn meshcatstic:app`
To run the client: `meshcat ... command`

## Future features

- Streaming text respsonse for progress
- RP2040 support w/ picotool
- Full erase and flash

