2021-04-27 14:06:41 -07:00
---
id: mqtt
2022-06-24 19:42:37 -07:00
title: 1.2 MQTT Settings
sidebar_label: 1.2 MQTT
2021-04-27 14:06:41 -07:00
---
2021-07-26 09:07:56 -07:00
2021-05-05 09:18:44 -07:00
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
2021-05-04 09:22:20 -07:00
:::note
2022-08-31 20:20:00 -07:00
This is still under development, use at your own risk. Report any bugs you see by creating an issue on the [meshtastic/Meshtastic-device](https://github.com/meshtastic/Meshtastic-device) repository or comment on our forum.
2021-05-04 09:22:20 -07:00
:::
2021-04-27 14:06:41 -07:00
2021-05-04 09:22:20 -07:00
:::caution
You may want to change your [GPS location sharing settings](gps#location_share) if you are enabling this. It will broadcast your location over the internet.
:::
2021-04-27 14:06:41 -07:00
2021-05-04 09:22:20 -07:00
## Overview
2021-04-27 14:06:41 -07:00
2021-05-04 09:22:20 -07:00
If your device is connected to WiFi you can enable it to forward messages along to an MQTT server. This allows users on the local mesh to communicate with users on the internet.
2021-04-27 14:06:41 -07:00
2022-03-08 23:10:41 -08:00
Be sure to checkout this [MQTT](/docs/software/other/mqtt) too.
2021-12-28 13:27:27 -08:00
2021-04-27 14:06:41 -07:00
## Settings
2022-03-08 23:10:41 -08:00
| Setting | Acceptable Values | Default |
| :---------------------: | :---------------: | :-----: |
2022-08-31 20:20:00 -07:00
| downlink_enabled | `true`, `false` | `false` |
| mqtt_disabled | `true`, `false` | `false` |
| mqtt_encryption_enabled | `true`, `false` | `false` |
| mqtt_password | `string` | `""` |
| mqtt_server | `string` | `""` |
2022-03-08 23:10:41 -08:00
| mqtt_username | `string` | `""` |
2022-08-31 20:20:00 -07:00
| uplink_enabled | `true`, `false` | `false` |
2021-05-03 13:15:01 -07:00
2022-02-02 11:46:12 -08:00
### downlink_enabled
This is a channel specific setting. If your channel has this set to `true` and you are connected to WiFi, the device will forward along messages from the MQTT server specified [here](#mqtt_server) to the mesh from this device.
2022-02-04 15:13:41 -08:00
#### Enable/Disable downlink_enabled
2022-03-08 23:10:41 -08:00
2022-02-04 15:13:41 -08:00
<Tabs
2022-03-08 23:10:41 -08:00
groupId="settings"
defaultValue="cli"
values={[
{label: 'CLI', value: 'cli'},
{label: 'Android', value: 'android'},
{label: 'iOS', value: 'iOS'},
{label: 'Web', value: 'web'},
]}>
<TabItem value="cli">
2022-04-01 06:34:49 -07:00
```shell title="Enable downlink_enabled on PRIMARY channel"
2022-03-08 23:10:41 -08:00
meshtastic --ch-set downlink_enabled true --ch-index 0
```
2022-04-01 06:34:49 -07:00
```shell title="Disable downlink_enabled on PRIMARY channel"
2022-03-08 23:10:41 -08:00
meshtastic --ch-set downlink_enabled false --ch-index 0
```
2022-04-01 06:34:49 -07:00
```shell title="Enable downlink_enabled on OTHER channel"
2022-03-08 23:10:41 -08:00
meshtastic --ch-set downlink_enabled true --ch-index 1
```
2022-04-01 06:34:49 -07:00
```shell title="Disable downlink_enabled on OTHER channel"
2022-03-08 23:10:41 -08:00
meshtastic --ch-set downlink_enabled false --ch-index 1
```
2022-02-04 15:13:41 -08:00
</TabItem>
<TabItem value="android">
:::info
Configuring this setting is not yet available for the selected platform. If this is incorrect please update the documentation for this page.
:::
</TabItem>
<TabItem value="iOS">
:::info
Configuring this setting is not yet available for the selected platform. If this is incorrect please update the documentation for this page.
:::
</TabItem>
<TabItem value="web">
:::info
Configuring this setting is not yet available for the selected platform. If this is incorrect please update the documentation for this page.
:::
</TabItem>
</Tabs>
2021-05-03 13:15:01 -07:00
### mqtt_disabled
2022-01-27 09:26:02 -08:00
If a meshtastic node is able to reach the internet it will normally attempt to gateway any channels that are marked as `uplink_enabled` or `downlink_enabled`. But if this flag is set, all MQTT features will be disabled and no servers will be contacted.
2021-05-03 13:15:01 -07:00
2022-02-01 17:58:26 -08:00
#### Enable/Disable MQTT
2022-03-08 23:10:41 -08:00
2022-02-01 17:58:26 -08:00
<Tabs
2022-03-08 23:10:41 -08:00
groupId="settings"
defaultValue="cli"
values={[
{label: 'CLI', value: 'cli'},
{label: 'Android', value: 'android'},
{label: 'iOS', value: 'iOS'},
{label: 'Web', value: 'web'},
]}>
<TabItem value="cli">
2022-04-01 06:34:49 -07:00
```shell title="Enable MQTT (Default)"
2022-03-08 23:10:41 -08:00
meshtastic --set mqtt_disabled false
```
2022-04-01 06:34:49 -07:00
```shell title="Disable MQTT"
2022-03-08 23:10:41 -08:00
meshtastic --set mqtt_disabled true
```
2022-02-01 17:58:26 -08:00
</TabItem>
<TabItem value="android">
:::info
Configuring this setting is not yet available for the selected platform. If this is incorrect please update the documentation for this page.
:::
</TabItem>
<TabItem value="iOS">
:::info
Configuring this setting is not yet available for the selected platform. If this is incorrect please update the documentation for this page.
2022-02-02 10:02:10 -08:00
:::
</TabItem>
<TabItem value="web">
:::info
Configuring this setting is not yet available for the selected platform. If this is incorrect please update the documentation for this page.
:::
</TabItem>
</Tabs>
### mqtt_encryption_enabled
Determines whether or not the device sends the packets encrypted to/from your MQTT server.
:::tip
If you are using the default Meshtastic MQTT server, this setting will take no effect. All packets will continue to be encrypted regardless of this setting. Only custom servers will honor this setting.
:::
#### Enable/Disable MQTT Encryption
2022-03-08 23:10:41 -08:00
2022-02-02 10:02:10 -08:00
<Tabs
2022-03-08 23:10:41 -08:00
groupId="settings"
defaultValue="cli"
values={[
{label: 'CLI', value: 'cli'},
{label: 'Android', value: 'android'},
{label: 'iOS', value: 'iOS'},
{label: 'Web', value: 'web'},
]}>
<TabItem value="cli">
2022-04-01 06:34:49 -07:00
```shell title="Publish decrypted packets to MQTT (Default)"
2022-03-08 23:10:41 -08:00
meshtastic --set mqtt_encryption_enabled false
```
2022-04-01 06:34:49 -07:00
```shell title="Publish encrypted packets to MQTT"
2022-03-08 23:10:41 -08:00
meshtastic --set mqtt_encryption_enabled true
```
2022-02-02 10:02:10 -08:00
</TabItem>
<TabItem value="android">
:::info
Configuring this setting is not yet available for the selected platform. If this is incorrect please update the documentation for this page.
:::
</TabItem>
<TabItem value="iOS">
:::info
Configuring this setting is not yet available for the selected platform. If this is incorrect please update the documentation for this page.
2022-02-01 17:58:26 -08:00
:::
</TabItem>
<TabItem value="web">
:::info
Configuring this setting is not yet available for the selected platform. If this is incorrect please update the documentation for this page.
:::
</TabItem>
</Tabs>
2022-02-02 11:46:12 -08:00
### mqtt_password
2022-02-11 12:28:14 -08:00
MQTT password to use (most useful for a custom MQTT server). If using a custom server, this will be honoured even if empty. If using the default server, this will only be honoured if set, otherwise the device will use the default password `large4cats`.
2022-02-02 11:46:12 -08:00
2022-02-04 15:28:07 -08:00
#### Configure mqtt_password
2022-03-08 23:10:41 -08:00
2022-02-04 15:28:07 -08:00
<Tabs
2022-03-08 23:10:41 -08:00
groupId="settings"
defaultValue="cli"
values={[
{label: 'CLI', value: 'cli'},
{label: 'Android', value: 'android'},
{label: 'iOS', value: 'iOS'},
{label: 'Web', value: 'web'},
]}>
<TabItem value="cli">
2022-04-01 06:34:49 -07:00
```shell title="Set mqtt_password"
2022-03-08 23:10:41 -08:00
meshtastic --set mqtt_password mypassword
```
2022-04-01 06:34:49 -07:00
```shell title="Set mqtt_password (with spaces)"
2022-03-08 23:10:41 -08:00
meshtastic --set mqtt_password "my password"
```
2022-04-01 06:34:49 -07:00
```shell title="Unset mqtt_password (Default)"
2022-03-08 23:10:41 -08:00
meshtastic --set mqtt_password ""
```
2022-02-04 15:28:07 -08:00
</TabItem>
<TabItem value="android">
:::info
Configuring this setting is not yet available for the selected platform. If this is incorrect please update the documentation for this page.
:::
</TabItem>
<TabItem value="iOS">
:::info
Configuring this setting is not yet available for the selected platform. If this is incorrect please update the documentation for this page.
:::
</TabItem>
<TabItem value="web">
:::info
Configuring this setting is not yet available for the selected platform. If this is incorrect please update the documentation for this page.
:::
</TabItem>
</Tabs>
2021-05-03 13:15:01 -07:00
### mqtt_server
The server to use for our MQTT global message gateway feature. If not set, the default server will be used
2021-04-27 14:06:41 -07:00
2022-02-01 17:58:26 -08:00
#### Enable/Disable MQTT Server
2022-03-08 23:10:41 -08:00
2022-02-01 17:58:26 -08:00
<Tabs
2022-03-08 23:10:41 -08:00
groupId="settings"
defaultValue="cli"
values={[
{label: 'CLI', value: 'cli'},
{label: 'Android', value: 'android'},
{label: 'iOS', value: 'iOS'},
{label: 'Web', value: 'web'},
]}>
<TabItem value="cli">
2022-02-01 17:58:26 -08:00
:::tip
When the mqtt_server is set to `""`, it will default to `mqtt.meshtastic.org`
:::
2022-04-01 06:34:49 -07:00
```shell title="Enable MQTT Server - Public Meshtastic MQTT Server (Default)"
2022-03-08 23:10:41 -08:00
meshtastic --set mqtt_server ""
```
2022-04-01 06:34:49 -07:00
```shell title="Enable MQTT Server - Personal MQTT Server (by IP)"
2022-03-08 23:10:41 -08:00
meshtastic --set mqtt_server 198.168.0.2
```
2022-04-01 06:34:49 -07:00
```shell title="Enable MQTT Server - Personal MQTT Server (by URL)"
2022-03-08 23:10:41 -08:00
meshtastic --set mqtt_server mqtt.mydomain.com
```
2022-02-01 17:58:26 -08:00
</TabItem>
<TabItem value="android">
:::info
Configuring this setting is not yet available for the selected platform. If this is incorrect please update the documentation for this page.
:::
</TabItem>
<TabItem value="iOS">
:::info
Configuring this setting is not yet available for the selected platform. If this is incorrect please update the documentation for this page.
:::
</TabItem>
<TabItem value="web">
:::info
Configuring this setting is not yet available for the selected platform. If this is incorrect please update the documentation for this page.
:::
</TabItem>
</Tabs>
2022-01-26 14:39:53 -08:00
### mqtt_username
2022-02-11 12:28:14 -08:00
MQTT username to use (most useful for a custom MQTT server). If using a custom server, this will be honoured even if empty. If using the default server, this will only be honoured if set, otherwise the device will use the default username `meshdev`.
2022-01-26 14:39:53 -08:00
2022-02-04 15:29:56 -08:00
#### Configure mqtt_username
2022-03-08 23:10:41 -08:00
2022-02-04 15:29:56 -08:00
<Tabs
2022-03-08 23:10:41 -08:00
groupId="settings"
defaultValue="cli"
values={[
{label: 'CLI', value: 'cli'},
{label: 'Android', value: 'android'},
{label: 'iOS', value: 'iOS'},
{label: 'Web', value: 'web'},
]}>
<TabItem value="cli">
2022-04-01 06:34:49 -07:00
```shell title="Set mqtt_username"
2022-03-08 23:10:41 -08:00
meshtastic --set mqtt_username myusername
```
2022-04-01 06:34:49 -07:00
```shell title="Set mqtt_username (with spaces)"
2022-03-08 23:10:41 -08:00
meshtastic --set mqtt_username "my username"
```
2022-04-01 06:34:49 -07:00
```shell title="Unset mqtt_username (Default)"
2022-03-08 23:10:41 -08:00
meshtastic --set mqtt_username ""
```
2022-02-04 15:29:56 -08:00
</TabItem>
<TabItem value="android">
:::info
Configuring this setting is not yet available for the selected platform. If this is incorrect please update the documentation for this page.
:::
</TabItem>
<TabItem value="iOS">
:::info
Configuring this setting is not yet available for the selected platform. If this is incorrect please update the documentation for this page.
:::
</TabItem>
<TabItem value="web">
:::info
Configuring this setting is not yet available for the selected platform. If this is incorrect please update the documentation for this page.
:::
</TabItem>
</Tabs>
2022-01-27 09:26:02 -08:00
### uplink_enabled
2021-05-04 09:22:20 -07:00
2022-02-01 17:58:26 -08:00
This is a channel specific setting. If your channel has this set to `true` and you are connected to WiFi, the device will forward along messages to whatever MQTT server is specified in [mqtt_server](#mqtt_server).
2021-05-04 09:22:20 -07:00
2022-02-04 15:20:10 -08:00
#### Enable/Disable uplink_enabled
2022-03-08 23:10:41 -08:00
2022-02-04 15:20:10 -08:00
<Tabs
2022-03-08 23:10:41 -08:00
groupId="settings"
defaultValue="cli"
values={[
{label: 'CLI', value: 'cli'},
{label: 'Android', value: 'android'},
{label: 'iOS', value: 'iOS'},
{label: 'Web', value: 'web'},
]}>
<TabItem value="cli">
2022-04-01 06:34:49 -07:00
```shell title="Enable uplink_enabled on PRIMARY channel"
2022-03-08 23:10:41 -08:00
meshtastic --ch-set uplink_enabled true --ch-index 0
```
2022-04-01 06:34:49 -07:00
```shell title="Disable uplink_enabled on PRIMARY channel"
2022-03-08 23:10:41 -08:00
meshtastic --ch-set uplink_enabled false --ch-index 0
```
2022-04-01 06:34:49 -07:00
```shell title="Enable uplink_enabled on OTHER channel"
2022-03-08 23:10:41 -08:00
meshtastic --ch-set uplink_enabled true --ch-index 1
```
2022-04-01 06:34:49 -07:00
```shell title="Disable uplink_enabled on OTHER channel"
2022-03-08 23:10:41 -08:00
meshtastic --ch-set uplink_enabled false --ch-index 1
```
2022-02-04 15:20:10 -08:00
</TabItem>
<TabItem value="android">
:::info
Configuring this setting is not yet available for the selected platform. If this is incorrect please update the documentation for this page.
:::
</TabItem>
<TabItem value="iOS">
:::info
Configuring this setting is not yet available for the selected platform. If this is incorrect please update the documentation for this page.
:::
</TabItem>
<TabItem value="web">
:::info
Configuring this setting is not yet available for the selected platform. If this is incorrect please update the documentation for this page.
:::
</TabItem>
</Tabs>
2021-04-27 14:06:41 -07:00
## Details
2021-07-26 09:07:56 -07:00
2021-05-04 09:22:20 -07:00
<!--- TODO --->
2021-05-05 09:18:44 -07:00
## Examples
2021-05-04 09:22:20 -07:00
2021-05-05 09:18:44 -07:00
<Tabs
2021-07-26 09:07:56 -07:00
groupId="settings"
defaultValue="cli"
values={[
{label: 'CLI', value: 'cli'},
{label: 'Android', value: 'android'},
2022-01-30 18:29:49 -08:00
{label: 'iOS', value: 'iOS'},
{label: 'Web', value: 'web'},
2021-07-26 09:07:56 -07:00
]}>
2022-03-08 23:10:41 -08:00
<TabItem value="cli">
2021-07-26 09:07:56 -07:00
2022-04-01 06:34:49 -07:00
```shell title="Set server"
2021-07-26 09:07:56 -07:00
meshtastic --set mqtt_server 192.168.123.234
```
2022-04-01 06:34:49 -07:00
```shell title="Enable MQTT server to mesh"
2021-12-28 13:27:27 -08:00
meshtastic --ch-set uplink_enabled true --ch-set downlink_enabled true --ch-index 0
2021-07-26 09:07:56 -07:00
```
2022-04-01 06:34:49 -07:00
```shell title="View raw encoded messages using mosquitto"
2021-07-26 09:07:56 -07:00
mosquitto_sub -h 192.168.123.234 -v -t msh/#
```
:::note
FIXME some documentation says msh/# , some says mesh/# . As of 1.2.39 the messages are on msh/#
:::
2022-04-01 06:34:49 -07:00
2022-03-08 23:10:41 -08:00
</TabItem>
<TabItem value="android">
2022-01-30 18:29:49 -08:00
:::info
Configuring this setting is not yet available for the selected platform. If this is incorrect please update the documentation for this page.
:::
</TabItem>
<TabItem value="iOS">
2021-05-05 09:18:44 -07:00
2022-01-30 18:29:49 -08:00
:::info
Configuring this setting is not yet available for the selected platform. If this is incorrect please update the documentation for this page.
:::
</TabItem>
<TabItem value="web">
:::info
Configuring this setting is not yet available for the selected platform. If this is incorrect please update the documentation for this page.
:::
2021-05-05 09:18:44 -07:00
</TabItem>
2022-08-31 20:20:00 -07:00
</Tabs>