diff --git a/README.md b/README.md index c3d4ae5..ce8c4d7 100644 --- a/README.md +++ b/README.md @@ -74,6 +74,7 @@ My version of the map is available at https://meshtastic.liamcottle.net - not affiliated with meshtastic info - donate link - login/register to add nodes to the map manually + - need to prevent spam - captcha for reg - limit how many nodes can be added from an account @@ -159,7 +160,7 @@ node src/mqtt.js --help ``` Meshtastic MQTT Collector - Collects and processes service envelopes from a Meshtastic MQTT server. + Collects and processes service envelopes from a Meshtastic MQTT server. Options @@ -167,6 +168,7 @@ Options --mqtt-broker-url string MQTT Broker URL (e.g: mqtt://mqtt.meshtastic.org) --mqtt-username string MQTT Username (e.g: meshdev) --mqtt-password string MQTT Password (e.g: large4cats) + --mqtt-topic MQTT Topic to subscribe to (e.g: msh/#) --collect-service-envelopes This option will save all received service envelopes to the database. --collect-text-messages This option will save all received text messages to the database. --collect-waypoints This option will save all received waypoints to the database. diff --git a/src/mqtt.js b/src/mqtt.js index 9c78076..032b9bc 100644 --- a/src/mqtt.js +++ b/src/mqtt.js @@ -31,6 +31,11 @@ const optionsList = [ type: String, description: "MQTT Password (e.g: large4cats)", }, + { + name: "mqtt-topic", + type: String, + description: "MQTT Topic to subscribe to (e.g: msh/#)", + }, { name: "collect-service-envelopes", type: Boolean, @@ -108,6 +113,7 @@ if(options.help){ const mqttBrokerUrl = options["mqtt-broker-url"] ?? "mqtt://mqtt.meshtastic.org"; const mqttUsername = options["mqtt-username"] ?? "meshdev"; const mqttPassword = options["mqtt-password"] ?? "large4cats"; +const mqttTopic = options["mqtt-topic"] ?? "#"; const collectServiceEnvelopes = options["collect-service-envelopes"] ?? false; const collectPositions = options["collect-positions"] ?? false; const collectTextMessages = options["collect-text-messages"] ?? false; @@ -269,7 +275,7 @@ function decrypt(packet) { // subscribe to everything when connected client.on("connect", () => { - client.subscribe("#"); + client.subscribe(mqttTopic); }); // handle message received