This commit is contained in:
Geoff Whittington
2022-12-04 19:42:42 -05:00
parent 1f4027829e
commit 6585f52f91
3 changed files with 10 additions and 4 deletions
+6 -1
View File
@@ -199,7 +199,7 @@ webhook:
- **log_level** `debug` or `info`. Default `info`
- **active** Plugin is active. Values: `true` or `false`. Default = `true`.
- **name** Reference of an existing MQTT server configured in the top-level `mqtt_servers` configuration
- **message** Override the packet message with a custom value
- **message** Override the packet message with a custom value.
- **topic** The message topic
For example:
@@ -210,6 +210,10 @@ mqtt_plugin:
topic: meshtastic/topic
```
Placeholders can be used with the **message** value:
- `{MSG}` - Packet text
### encrypt_filter - Encrypt a packet before sending it to a MQTT server
- **log_level** `debug` or `info`. Default `info`
@@ -286,3 +290,4 @@ docker run --rm --network host -v $(pwd)/config.yaml:/code/config.yaml gwhitting
## Resources
- Example guidance for creating [PEM](https://www.suse.com/support/kb/doc/?id=000018152) key files.
- Test webhooks using [Webhooks.site](https://webhook.site/)
-1
View File
@@ -136,7 +136,6 @@ if "mqtt_servers" in bridge_config:
def on_message(mqttc, obj, msg):
orig_packet = msg.payload.decode()
logger.debug(f"MQTT {config['name']}: on_message")
logger.debug(f"MQTT {config['name']}: {orig_packet}")
if "pipelines" not in config:
+4 -2
View File
@@ -242,8 +242,8 @@ class WebhookPlugin(Plugin):
text = packet["decoded"]["text"] if "text" in packet["decoded"] else None
macros = {
"{LAT}": position["latitude"] if position else None,
"{LNG}": position["longitude"] if position else None,
"{LAT}": position["latitude"] if position else "",
"{LNG}": position["longitude"] if position else "",
"{MSG}": self.config["message"] if "message" in self.config else text,
"{FID}": packet["fromId"],
"{TID}": packet["toId"],
@@ -312,6 +312,8 @@ class MQTTPlugin(Plugin):
self.logger.debug("Message sent")
return packet
plugins["mqtt_plugin"] = MQTTPlugin()