53 lines
1.4 KiB
Markdown
53 lines
1.4 KiB
Markdown
# MQTT RNV Publisher
|
|
|
|
A simple Rust application that publishes the RNV Live Station ticker into your MQTT Sever
|
|
|
|
## Dependencies
|
|
|
|
- tokio (with full features)
|
|
- rumqttc
|
|
- serde
|
|
- serde_json
|
|
- clap
|
|
- chrono
|
|
- reqwest (with blocking)
|
|
|
|
## Usage
|
|
|
|
```bash
|
|
cargo run -- --broker 192.168.1.100 --port 1883 --interval 60 --station Lettestr
|
|
```
|
|
|
|
Or run the binary directly:
|
|
|
|
```bash
|
|
./target/debug/mqtt-publisher --broker <address> --port <port> --interval <seconds> --station <name>
|
|
```
|
|
|
|
### Arguments
|
|
|
|
- `--broker`: MQTT broker address (default: `localhost`)
|
|
- `--port`: MQTT broker port (default: `1883`)
|
|
- `--interval`: Interval in seconds between departure data fetches (default: `300`)
|
|
- `--station`: Station name to look up (default: `Lettestr`)
|
|
|
|
## MQTT Topics
|
|
|
|
The application publishes departure data to the following topics:
|
|
|
|
- `departure/station`: Station name
|
|
- `departure/outbound/station`: Outbound destination station
|
|
- `departure/outbound/line`: Outbound line number/name
|
|
- `departure/outbound/diff`: Seconds until outbound departure
|
|
- `departure/inbound/station`: Inbound destination station
|
|
- `departure/inbound/line`: Inbound line number/name
|
|
- `departure/inbound/diff`: Seconds until inbound departure
|
|
- `departure/failure`: Error message if data fetch fails
|
|
|
|
## Configuration
|
|
|
|
Edit `src/main.rs` to customize:
|
|
- Broker address (default: `localhost:1883`)
|
|
- MQTT topic (default: `test/topic`)
|
|
- Message payload
|