barebone app with django and react, sse, jwt token, comport reader, test comport writer, requires com0com, users with groups, sample table vehicles, tokens for access and refresh
This commit is contained in:
@@ -0,0 +1,71 @@
|
||||
# Serial Bridge - COM Port Reader
|
||||
|
||||
This is the serial port reading application that runs as a system tray service.
|
||||
|
||||
## Features
|
||||
|
||||
- ✅ Reads data from COM ports
|
||||
- ✅ Runs in system tray (no console window)
|
||||
- ✅ Automatically posts data to Django backend
|
||||
- ✅ Retry logic for failed posts
|
||||
- ✅ Backend health checks
|
||||
- ✅ Configurable via environment variables
|
||||
- ✅ Can be packaged as a Windows .exe
|
||||
|
||||
## Setup
|
||||
|
||||
1. **Install Python dependencies:**
|
||||
```bash
|
||||
pip install -r requirements.txt
|
||||
```
|
||||
|
||||
2. **Configure environment:**
|
||||
```bash
|
||||
copy .env.example .env
|
||||
# Edit .env with your settings
|
||||
```
|
||||
|
||||
3. **Run the application:**
|
||||
```bash
|
||||
python app.py
|
||||
```
|
||||
|
||||
## Building as EXE
|
||||
|
||||
To create a standalone Windows executable:
|
||||
|
||||
```bash
|
||||
pip install pyinstaller
|
||||
pyinstaller serial_bridge.spec
|
||||
```
|
||||
|
||||
The executable will be created in the `dist\ScalesApp\` folder.
|
||||
|
||||
## Configuration
|
||||
|
||||
Edit `.env` to configure:
|
||||
|
||||
- `COM_PORT`: COM port to read from (default: COM1)
|
||||
- `BAUD_RATE`: Serial port baud rate (default: 9600)
|
||||
- `BACKEND_URL`: Django backend URL (default: http://localhost:8000)
|
||||
- `AUTO_CONNECT`: Automatically connect on startup (default: True)
|
||||
- `DEBUG`: Enable debug logging (default: False)
|
||||
|
||||
## Architecture
|
||||
|
||||
```
|
||||
COM Port → Serial Reader → Backend Client → Django API
|
||||
↓
|
||||
System Tray Icon
|
||||
```
|
||||
|
||||
## Logging
|
||||
|
||||
Logs are written to `serial_bridge.log` and console output.
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
- **COM port not found**: Check `COM_PORT` setting and device connection
|
||||
- **Cannot connect to backend**: Verify Django server is running on `BACKEND_URL`
|
||||
- **Data not posting**: Check logs in `serial_bridge.log`
|
||||
- **Tray icon not appearing**: Run as administrator, check Windows settings
|
||||
Reference in New Issue
Block a user