Skip to content

Commit d4e6c3e

Browse files
feat(mqtt): add CONFIG_MESHTASTIC_DEFAULT_OK_TO_MQTT seed
Nothing set config.lora.config_ok_to_mqtt, so the consent bit the previous commit added could only ever be false without a phone-app or admin write. Seed it from Kconfig, defaulting to n to match the reference. Consent to having your traffic carried off the local RF mesh and onto a broker — possibly a public one — should be opt-in, so the shared default stays off and a deployment that wants it enables it locally. This governs only our OWN traffic. Whether this node republishes other people's packets is decided by their bit and by whether the broker is private, which is the other half and unchanged here.
1 parent 201be36 commit d4e6c3e

2 files changed

Lines changed: 20 additions & 0 deletions

File tree

src/Kconfig.core

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,24 @@ config MESHTASTIC_DEFAULT_REGION
115115

116116
A US device needs no licence: 902-928 MHz is unlicensed ISM spectrum.
117117

118+
config MESHTASTIC_DEFAULT_OK_TO_MQTT
119+
bool "Consent to our traffic being republished to MQTT by default"
120+
default n
121+
help
122+
Seeds config.lora.config_ok_to_mqtt on first boot. When set, every
123+
packet this node originates carries the OK_TO_MQTT bit, telling any
124+
gateway that hears it that our traffic may be republished to an MQTT
125+
broker — including a public one.
126+
127+
Defaults to n, matching the reference firmware: consent to being
128+
rebroadcast off the local RF mesh should be opt-in.
129+
130+
This governs only OUR OWN traffic. Whether this node republishes other
131+
people's packets is a separate matter, decided by their bit and by
132+
whether the configured broker is private.
133+
134+
A later admin or phone-app change overrides this seed.
135+
118136
config MESHTASTIC_TX_POWER
119137
int "Default TX power (dBm)"
120138
default 17

src/meshtastic_config_store.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -415,6 +415,8 @@ static void seed_config_defaults(const struct meshtastic_config *cfg)
415415

416416
idx = index_for_config_tag(meshtastic_Config_lora_tag);
417417
store.configs[idx].payload_variant.lora.use_preset = true;
418+
store.configs[idx].payload_variant.lora.config_ok_to_mqtt =
419+
IS_ENABLED(CONFIG_MESHTASTIC_DEFAULT_OK_TO_MQTT);
418420
store.configs[idx].payload_variant.lora.modem_preset =
419421
meshtastic_Config_LoRaConfig_ModemPreset_LONG_FAST;
420422
/* Declared, not inferred. The region used to be derived from the

0 commit comments

Comments
 (0)