Update Readme
This commit is contained in:
34
README.md
34
README.md
@@ -1,6 +1,6 @@
|
|||||||
# MQTT Publisher
|
# MQTT RNV Publisher
|
||||||
|
|
||||||
A simple Rust application that publishes messages to an MQTT broker.
|
A simple Rust application that publishes the RNV Live Station ticker into your MQTT Sever
|
||||||
|
|
||||||
## Dependencies
|
## Dependencies
|
||||||
|
|
||||||
@@ -12,20 +12,34 @@ A simple Rust application that publishes messages to an MQTT broker.
|
|||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
cargo run -- 192.168.1.100 1883
|
cargo run -- --broker 192.168.1.100 --port 1883 --interval 60 --station Lettestr
|
||||||
```
|
```
|
||||||
|
|
||||||
Or run the binary directly:
|
Or run the binary directly:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
./target/debug/mqtt-publisher [broker] [port]
|
./target/debug/mqtt-publisher --broker <address> --port <port> --interval <seconds> --station <name>
|
||||||
```
|
```
|
||||||
|
|
||||||
### Arguments
|
### Arguments
|
||||||
|
|
||||||
- `broker`: MQTT broker address (default: `localhost`)
|
- `--broker`: MQTT broker address (default: `localhost`)
|
||||||
- `port`: MQTT broker port (default: `1883`)
|
- `--port`: MQTT broker port (default: `1883`)
|
||||||
- `interval`: Interval in seconds between departure data fetches (default: `300`)
|
- `--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
|
## Configuration
|
||||||
|
|
||||||
@@ -33,9 +47,3 @@ Edit `src/main.rs` to customize:
|
|||||||
- Broker address (default: `localhost:1883`)
|
- Broker address (default: `localhost:1883`)
|
||||||
- MQTT topic (default: `test/topic`)
|
- MQTT topic (default: `test/topic`)
|
||||||
- Message payload
|
- Message payload
|
||||||
|
|
||||||
## Example
|
|
||||||
|
|
||||||
```rust
|
|
||||||
client.publish("your/topic", QoS::AtLeastOnce, false, b"Your message").await?;
|
|
||||||
```
|
|
||||||
|
|||||||
Reference in New Issue
Block a user