diff options
author | Tomasz Kramkowski <tomasz@kramkow.ski> | 2025-06-27 19:57:00 +0100 |
---|---|---|
committer | Tomasz Kramkowski <tomasz@kramkow.ski> | 2025-06-27 21:46:51 +0100 |
commit | 00b2e9bb80e7fcd310fa0b0a719726665d2fcbe2 (patch) | |
tree | 3a303c5b05f784b08d9799124e0e64811fb49948 /README.md | |
parent | b440529967d5585d95a33c8f14c2436d54908db5 (diff) | |
download | mqttr-00b2e9bb80e7fcd310fa0b0a719726665d2fcbe2.tar.gz mqttr-00b2e9bb80e7fcd310fa0b0a719726665d2fcbe2.tar.xz mqttr-00b2e9bb80e7fcd310fa0b0a719726665d2fcbe2.zip |
Pass packet metadata as arguments
DUP, QoS, RETAIN and the packet identifier
Diffstat (limited to 'README.md')
-rw-r--r-- | README.md | 10 |
1 files changed, 7 insertions, 3 deletions
@@ -55,14 +55,19 @@ The routes follow the following format: On startup, `mqttr` will read the config file and subscribe to all the topics. When a message is received, `mqttr` will match the message topic against the routes and execute every program which is part of a matching route. Each program -will have the message topic appended as an additional argument and will receive -the message on stdin. +will have the message topic as well as the DUP, QoS, RETAIN and Packet +Identifier (when applicable) appended as an additional arguments (in that order) +and will receive the message on stdin. An example program is this script: ```bash #!/usr/bin/env bash topic=$1 +dup=$2 +qos=$3 +retain=$4 +((qos == 1 || qos == 2)) && pkid=$5 action=$(jq --raw-output .action) [[ $action == "toggle" ]] || exit 0 mosquitto_pub --topic "zigbee2mqtt/light/set" --message '{"state":"TOGGLE"}' @@ -75,7 +80,6 @@ it being ran every time a new MQTT message is published to this topic. * Configurable timeouts (eventually configurable per process) * Configurable QoS for each subscription (default is 0 (at most once)) -* Pass message metadata via the environment (QoS, retain, dup) * Configurable logging * Ability to configure programs with non-UTF-8 in paths * Maybe config reloading on SIGHUP |