Metadata-Version: 2.1
Name: mqtt-recorder
Version: 1.4.0
Summary: MQTT recorder tool
Author: RPDSWTK
License: MIT License
        
        Copyright (c) 2020 RPDSWTK
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
Project-URL: Homepage, https://github.com/rpdswtk/mqtt_recorder
Keywords: feed,reader,tutorial
Requires-Python: >=3.7
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: paho-mqtt>=2.0.0
Requires-Dist: tqdm>=4.65.0

# MQTT Recorder

Simple cli tool for recording and replaying MQTT messages.

# Install

`pip install mqtt-recorder`

## Usage
| Argument               | Description                                              | Required | Default |
| ---------------------- | -------------------------------------------------------- | -------- | ------- |
| -h, --help             | Show help                                                |          |         |
| --host                 | MQTT broker address                                      | x        |         |
| --port                 | MQTT broker port                                         |          | 1883    |
| --client_id            | MQTT Client ID                                           |          |         |
| --mode                 | mode: record/replay                                      | x        |         |
| --file                 | output/input csv file                                    | x        |         |
| --loop                 | looping replay                                           |          | false   |
| --qos                  | Quality of Service that will be used for subscriptions   |          | 0       |
| --topics               | json file containing selected topics for subscriptions   |          | null    |
| -t, --topic             | Single topic to subscribe to                             |          | null    |
| --enable_ssl           | True to enable MQTTs support, False otherwise            |          | False   |
| --tls_insecure         | If certs is self-generated, change to True               |          | False   |
| --ca_cert              | Path to the Certificate Authority certificate files      |          | None    |
| --certfile             | Path to the client certificate                           |          | None    |
| --keyfile              | Path to the client private key                           |          | None    |
| --username             | MQTT broker username                                     |          | None    |
| --password             | MQTT broker password                                     |          | None    |
| --encode_b64           | True to store message payloads as base64 encoded strings |          | False   |
| --csv_field_size_limit | CSV field size limit                                     |          | False   |

### Recording
#### Subscribing to every topic
`mqtt-recorder --host localhost --mode record --file recording.csv`
#### Subscribing to selected topics
`mqtt-recorder --host localhost --mode record --file test.csv --topics topics.json`<br>
Topics can be selected using a json file.
Example
```json
{
    "topics": [
        "/myhome/groundfloor/livingroom/temperature",
        "USA/California/San Francisco/Silicon Valley"
    ]
}
```
### Replaying
`mqtt-recorder --host localhost --mode replay --file test.csv`
