{"id":24769426,"url":"https://github.com/27escape/mqtt2jsonl","last_synced_at":"2026-05-05T03:37:43.084Z","repository":{"id":273345743,"uuid":"865424584","full_name":"27escape/mqtt2jsonl","owner":"27escape","description":"Record and replay MQTT messages sent to a particular topic. The messages are recorded to a JSONL (https://jsonlines.org/) file","archived":false,"fork":false,"pushed_at":"2025-01-20T10:21:33.000Z","size":67,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-29T02:54:22.780Z","etag":null,"topics":["cli","jsonlines","mqtt","python","python3","record","recorder","replay"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/27escape.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-09-30T14:05:57.000Z","updated_at":"2025-01-20T10:21:34.000Z","dependencies_parsed_at":null,"dependency_job_id":"bef68ce0-5740-4841-aa61-27be2de32259","html_url":"https://github.com/27escape/mqtt2jsonl","commit_stats":null,"previous_names":["27escape/mqtt2jsonl"],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/27escape%2Fmqtt2jsonl","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/27escape%2Fmqtt2jsonl/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/27escape%2Fmqtt2jsonl/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/27escape%2Fmqtt2jsonl/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/27escape","download_url":"https://codeload.github.com/27escape/mqtt2jsonl/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245154318,"owners_count":20569481,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cli","jsonlines","mqtt","python","python3","record","recorder","replay"],"created_at":"2025-01-29T02:53:43.036Z","updated_at":"2026-05-05T03:37:43.079Z","avatar_url":"https://github.com/27escape.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"#  mqtt2jsonl\n\nThis is a simple script to listen to MQTT messages and store them into a [JSONL](https://jsonlines.org/) file. This JSONL file can then be replayed at a later date, which is useful for testing MQTT systems.\n\nI had a quick look on the Internet and could not see anything similar, though it likely exists, this just helps me at the moment.\n\n## Installation\n\n**TODO: Fix this when I understand how to package things properly**\n\nThis is a python3 script, if that does not match your requirements, please look elsewhere.\n\nThis is my first python code, so I have not created an account with PyPI or whatever, so you need to install from this dist\n\ninstall it\n```\npip install -r requirements.txt\npip install -e .\n```\nThis will make the script `mqtt2jsonl` available either in the virtualenv you are running in or your complete environment\n\nIf you want to make changes and rebuild, remember to update the version number in the `pyproject.toml` file.\n\n## Using it\n\nAssumption that you are using linux/unix otherwise prefix the command with `python3`, assuming your other OS has python3 installed and its accessible from a command prompt.\n\nHelp is available\n```\n./mqtt2jsonl -h\nusage: mqtt2jsonl [-h] [-v] [-f] [-j JSONL] [-s SERVER] [-p PORT] [-t TOPIC] [-d DELAY] cmd\n\nEither record or replay MQTT via a JSONL file\n\npositional arguments:\n  cmd                   Command to perform against the MQTT topic queue, 'record' or 'replay'\n\noptions:\n  -h, --help            show this help message and exit\n  -v, --verbose         Increase level of logging from WARNING to INFO\n  -f, --force           Force overwrite when destination file already exists\n  -j JSONL, --jsonl JSONL\n                        JSONL file to read from or write to\n  -s SERVER, --server SERVER\n                        MQTT server name/ip to connect to (localhost)\n  -p PORT, --port PORT  MQTT port to connect to (1883)\n  -t TOPIC, --topic TOPIC\n                        MQTT topic queue to listen to (for recording), usual wildcards apply (default everying as '#')\n  -d DELAY, --delay DELAY\n                        For replay, override the recorded delay between messages to use an artifical\n                        value in msecs, 0 means use record value\n```\n\n### Record\n\nConnect to default localhost port 1883, with a wildcard topic, overwriting any previous file\n```\n./mqtt2jsonl -j /tmp/record.jsonl record -t 'some_topic/#' -f\n```\n\nConnect to to named server and port, use default topic of everything (#) \n```\n./mqtt2jsonl -j /tmp/record.jsonl record --server some_mqtt_server --port 1000 \n```\n\nI have provided `sample.json` as an example of a recording, this is the recorded output of my gnarlypi project when copying files from my camera.\n\n### Replay\n\nConnect to default localhost port 1883, replay at the recorded rate\n```\n./mqtt2jsonl -j /tmp/record.jsonl replay \n```\n\nConnect to to named server and port, replay at a fast rate of one message per 5ms \n```\n./mqtt2jsonl -j /tmp/record.jsonl record --server some_mqtt_server --port 1000  --delay=5\n```\n\n\n\n## Improvements / TODO\n\nThere are a few things that could possibly make this a better more general tool but I don't need these features right now\n\n- [ ] Create a PyPI account and upload it there\n- [ ] Log in with a username/password\n- [ ] Log into a MQTT server that uses TLS\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F27escape%2Fmqtt2jsonl","html_url":"https://awesome.ecosyste.ms/projects/github.com%2F27escape%2Fmqtt2jsonl","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F27escape%2Fmqtt2jsonl/lists"}