Minimal TCP client/server simulator built with asyncio.
At this stage, the project supports basic TCP communication between client and server.
The server listens on port 9999, and settings can be changed in config.toml.
- Python 3.11+
- Linux or Windows
- Docker (optional, for containerized run)
python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
python src/main_server.py
python src/main_client.pypython -m venv .venv
.venv\Scripts\Activate.ps1
pip install -r requirements.txt
python src/main_server.py
python src/main_client.pyDeactivate venv:
deactivateThe client supports two interchangeable frontends. The default is the CLI.
Start the server first, then pick a frontend for the client:
# CLI (default)
python src/main_client.py
# Web frontend (Django)
python src/main_client.py --frontend webOnce the web frontend starts, open http://127.0.0.1:8000 in a browser to add
devices, view their live state, and update parameters. Override the bind
address with the WEB_HOST / WEB_PORT environment variables if needed.
In the CLI, use Show scheduler tasks to inspect automations currently stored
in the server scheduler.
Both frontends reuse the exact same client models and controllers; only the
view layer differs (src/smart_home/client/views/cli.py vs.
src/smart_home/client/views/web/).
python -m grpc_tools.protoc -I src --python_out=src src/smart_home/proto/v1/message.protoIf needed, install the generator first:
pip install grpcio-toolsIf needed, install pytest first:
pip install pytestRun all tests:
python -m pytest testsThe server can use Gemini through the Gemini API. Create a Gemini API key in
Google AI Studio, then put it in a local .env file:
cp .env.example .envEdit .env:
AI_PROVIDER=gemini
GEMINI_API_KEY=your-key
GEMINI_MODEL=gemini-3.5-flashThen start the server:
python src/main_server.pyThe default AI config is in config.toml:
[ai]
provider = "gemini"
gemini_model = "gemini-3.5-flash"Run only protobuf pytest tests:
python -m pytest tests/test_protobuf_pytest.pyRun protobuf serialization script test:
python tests/test_protobuf.py- Start only the server in background:
docker compose up -d server- Start client session:
docker compose run --rm client-
In the client prompt (
Client >), type your message and press Enter. -
(Optional) In another terminal, watch server logs:
docker compose logs -f server- Stop everything:
docker compose downThe root setup scripts can run the Docker automatically.
Linux, macOS, WSL, or Git Bash:
bash setup.shWindows PowerShell:
.\setup.ps1If Docker is not running, the scripts wait and retry until Docker becomes available.