meshtastic/docs/configuration/module/mqtt.mdx

260 lines
8.9 KiB
Plaintext
Raw Normal View History

2022-08-31 20:12:29 -07:00
---
id: mqtt
title: MQTT Module Configuration
sidebar_label: MQTT
---
2023-01-19 05:01:57 -08:00
import Tabs from "@theme/Tabs";
import TabItem from "@theme/TabItem";
2022-08-31 20:12:29 -07:00
2023-09-28 19:10:42 -07:00
If your device is connected to Internet via wifi or ethernet, you can enable it to forward packets along to an MQTT server. This allows users on the local mesh to communicate with users on the internet. One or more channels must also be enabled as uplink and/or downlink for packets to be transmitted from and/or to your mesh (See [channels](/docs/configuration/radio/channels#downlink-enabled)). Without these settings enabled, the node will still connect to the MQTT server but only send status messages.
2022-08-31 20:12:29 -07:00
2023-07-07 22:19:08 -07:00
The MQTT module config options are: Enabled, Server Address, Username, Password, Encryption Enabled, JSON Enabled, TLS Enabled, and Root Topic. MQTT Module config uses an admin message sending a `ConfigModule.MQTT` protobuf.
2022-08-31 20:12:29 -07:00
## Settings
2023-08-25 20:30:14 -07:00
2023-01-19 05:01:57 -08:00
## MQTT Module Config Values
2022-08-31 20:12:29 -07:00
### Enabled
Enables the MQTT module.
### Server Address
2023-07-07 22:29:05 -07:00
The server to use for MQTT. If not set, the default public server will be used.
2022-08-31 20:12:29 -07:00
### Username
2022-11-02 11:46:54 -07:00
MQTT Server username to use (most useful for a custom MQTT server). If using a custom server, this will be honored even if empty. If using the default public server, this will only be honored if set, otherwise the device will use the default username.
2022-08-31 20:12:29 -07:00
### Password
2023-07-07 22:29:05 -07:00
MQTT password to use (most useful for a custom MQTT server). If using a custom server, this will be honored even if empty. If using the default server, this will only be honored if set, otherwise the device will use the default password.
2022-08-31 20:12:29 -07:00
### Encryption Enabled
2023-07-07 22:29:05 -07:00
Whether to send encrypted or unencrypted packets to MQTT. This parameter is only honored if you also set server (the default official mqtt.meshtastic.org server can handle encrypted packets). Unencrypted packets may be useful for external systems that want to consume meshtastic packets.
2022-08-31 20:12:29 -07:00
2022-09-03 14:54:03 -07:00
### JSON Enabled
Enable the sending / consumption of JSON packets on MQTT. These packets are not encrypted, but offer an easy way to integrate with systems that can read JSON.
2023-07-07 22:19:08 -07:00
### TLS Enabled
2023-07-07 22:29:05 -07:00
If true, we attempt to establish a secure connection using TLS.
2023-07-07 22:19:08 -07:00
### Root Topic
2023-07-07 22:31:26 -07:00
The root topic to use for MQTT messages. This is useful if you want to use a single MQTT server for multiple meshtastic networks and separate them via ACLs.
2023-07-07 22:19:08 -07:00
2022-08-31 20:12:29 -07:00
2023-08-25 20:30:14 -07:00
## MQTT Module Config Client Availability
2022-08-31 20:12:29 -07:00
<Tabs
groupId="settings"
defaultValue="apple"
values={[
{label: 'Android', value: 'android'},
{label: 'Apple', value: 'apple'},
{label: 'CLI', value: 'cli'},
{label: 'Web', value: 'web'},
]}>
<TabItem value="android">
:::info
2022-12-04 13:30:08 -08:00
MQTT Config options are available for Android.
1. Open the Meshtastic App
2023-06-17 22:06:11 -07:00
2. Navigate to: **Vertical Ellipsis (3 dots top right) > Radio Configuration > MQTT**
2022-12-04 13:30:08 -08:00
2022-08-31 20:12:29 -07:00
:::
</TabItem>
<TabItem value="apple">
:::info
2023-07-07 22:29:05 -07:00
MQTT Config options are available on iOS, iPadOS and macOS at Settings > Modules > MQTT.
2022-08-31 20:12:29 -07:00
:::
</TabItem>
<TabItem value="cli">
:::info
2022-08-31 20:12:29 -07:00
All MQTT module config options are available in the python CLI. Example commands are below:
:::
2023-07-07 22:19:08 -07:00
| Setting | Acceptable Values | Default |
| :---------------------: | :---------------: | :-----------------: |
| mqtt.enabled | `true`, `false` | `false` |
| mqtt.address | `string` |`mqtt.meshtastic.org`|
| mqtt.username | `string` | `meshdev` |
| mqtt.password | `string` | `large4cats` |
| mqtt.encryption_enabled | `true`, `false` | `false` |
| mqtt.json_enabled | `true`, `false` | `false` |
| mqtt.tls_enabled | `true`, `false` | `false` |
2023-07-07 22:31:26 -07:00
| mqtt.root | `string` | |
2022-08-31 20:12:29 -07:00
:::tip
Because the device will reboot after each command is sent via CLI, it is recommended when setting multiple values in a config section that commands be chained together as one.
```shell title="Example:"
meshtastic --set mqtt.enabled true --set mqtt.json_enabled true
```
:::
2022-08-31 20:12:29 -07:00
```shell title="Enable/Disable MQTT Module"
meshtastic --set mqtt.enabled true
meshtastic --set mqtt.enabled false
```
```shell title="Enable/Disable MQTT JSON"
meshtastic --set mqtt.json_enabled true
meshtastic --set mqtt.json_enabled false
2022-08-31 20:12:29 -07:00
```
</TabItem>
<TabItem value="web">
:::info
All MQTT module config options are available for the Web UI.
:::
2023-01-19 05:01:57 -08:00
2022-08-31 20:12:29 -07:00
</TabItem>
</Tabs>
2023-08-25 20:30:14 -07:00
## Connect to the Default Public Server
<Tabs
defaultValue="apple"
values={[
{label: 'Android', value: 'android'},
{label: 'Apple', value: 'apple'},
{label: 'CLI', value: 'cli'},
{label: 'Web', value: 'web'},
]}>
<TabItem value="android">
<h3>1. Enable the MQTT Module</h3>
Navigate to: Vertical Ellipsis (3 dots top right) > Radio configuration > MQTT: Turn on the slider for **MQTT enabled** and tap **Send**.
2023-09-11 20:56:30 -07:00
[![MQTT Settings](/img/modules/mqtt/android_mqtt_sm.png)](/img/modules/mqtt/android_mqtt.png)
2023-08-25 20:30:14 -07:00
*Optional:* To use your phone's internet connection to send and receive packets over the web, also enable the slider for **MQTT Client Proxy** and skip the Configure Network Settings step below.
2023-09-11 20:56:30 -07:00
[![Client Proxy](/img/modules/mqtt/android_mqtt_proxy_sm.png)](/img/modules/mqtt/android_mqtt_proxy.png)
2023-08-25 20:30:14 -07:00
<h3>2. Enable Channel Uplink & Downlink</h3>
Navigate to: Vertical Ellipsis (3 dots top right) > Radio configuration > Channels > LongFast: Turn on the sliders for **Uplink enabled** and **Downlink enabled**, then tap **Save** and tap **Send**.
2023-09-11 20:56:30 -07:00
[![Channel Settings](/img/modules/mqtt/android_channel_sm.png)](/img/modules/mqtt/android_channel.png)
2023-08-25 20:30:14 -07:00
<h3>3. Configure Network Settings</h3>
Navigate to: Vertical Ellipsis (3 dots top right) > Radio configuration > Network: Turn on the slider for **WiFi enabled**, Enter the **SSID** and **PSK** for your network, then tap **Send**.
2023-09-11 20:56:30 -07:00
[![Network Settings](/img/modules/mqtt/android_network_sm.png)](/img/modules/mqtt/android_network.png)
2023-08-25 20:30:14 -07:00
</TabItem>
<TabItem value="apple">
<h3>1. Enable the MQTT Module</h3>
2023-08-25 21:04:26 -07:00
Navigate to Settings > MQTT: Turn on the slider for MQTT enabled and tap **Save**
2023-08-25 20:30:14 -07:00
2023-09-11 20:56:30 -07:00
[![MQTT Settings 1](/img/modules/mqtt/apple_mqtt_1_sm.png)](/img/modules/mqtt/apple_mqtt_1.png)
[![MQTT Settings 2](/img/modules/mqtt/apple_mqtt_2_sm.png)](/img/modules/mqtt/apple_mqtt_2.png)
2023-08-25 20:30:14 -07:00
*Optional:* To use your phone's internet connection to send and receive packets over the web, also enable the slider for **MQTT Client Proxy** and skip the Configure Network Settings step below.
2023-09-11 20:56:30 -07:00
[![Client Proxy](/img/modules/mqtt/apple_mqtt_1_proxy_sm.png)](/img/modules/mqtt/apple_mqtt_1_proxy.png)
2023-08-25 20:30:14 -07:00
<h3>2. Enable Channel Uplink & Downlink</h3>
2023-08-25 21:04:26 -07:00
Navigate to Settings > Channels > Primary Channel: Turn on the sliders for **Uplink enabled** and **Downlink enabled** - Tap **Save**
2023-08-25 20:30:14 -07:00
2023-09-11 20:56:30 -07:00
[![Channel Settings](/img/modules/mqtt/apple_channel_sm.png)](/img/modules/mqtt/apple_channel.png)
2023-08-25 20:30:14 -07:00
<h3>3. Configure Network Settings</h3>
2023-08-25 21:04:26 -07:00
Navigate to Settings > Network: Turn on the slider for **WiFi enabled** - Enter your **SSID** and **PSK** for your network - Tap **Save**
2023-08-25 20:30:14 -07:00
2023-09-11 20:56:30 -07:00
[![Network Settings](/img/modules/mqtt/apple_network_sm.png)](/img/modules/mqtt/apple_network.png)
2023-08-25 20:30:14 -07:00
</TabItem>
<TabItem value="cli">
<h3>1. Enable the MQTT Module</h3>
```shell
meshtastic --set mqtt.enabled true
```
<h3>2. Enable Channel Uplink & Downlink</h3>
```shell
meshtastic --ch-set uplink_enabled true --ch-index 0
meshtastic --ch-set downlink_enabled true --ch-index 0
```
or chained together:
```shell
meshtastic --ch-set uplink_enabled true --ch-index 0 --ch-set downlink_enabled true --ch-index 0
```
<h3>3. Configure Network Settings</h3>
```shell
meshtastic --set network.wifi_enabled true
meshtastic --set network.wifi_ssid "your network"
meshtastic --set network.wifi_psk yourpassword
```
or chained together:
```shell
meshtastic --set network.wifi_enabled true --set network.wifi_ssid "your network" --set network.wifi_psk yourpassword
```
</TabItem>
<TabItem value="web">
<h3>1. Enable the MQTT Module</h3>
2023-08-25 21:04:26 -07:00
Navigate to Config > Module Config > MQTT - Turn on the slider for MQTT enabled - Click the **Save** icon.
2023-08-25 20:30:14 -07:00
2023-09-11 20:56:30 -07:00
[![MQTT Settings](/img/modules/mqtt/web_mqtt_sm.png)](/img/modules/mqtt/web_mqtt.png)
2023-08-25 20:30:14 -07:00
*Optional:* To use your client's internet connection to send and receive packets over the web, also enable the slider for **Proxy to Client Enabled** and skip the Configure Network Settings step below.
2023-09-11 20:56:30 -07:00
[![Client Proxy](/img/modules/mqtt/web_mqtt_proxy_sm.png)](/img/modules/mqtt/web_mqtt_proxy.png)
2023-08-25 20:30:14 -07:00
2023-08-25 21:04:26 -07:00
:::caution
Though this option may be visible in your UI, Client Proxy is not yet functional with the Web Client.
:::
2023-08-25 20:30:14 -07:00
<h3>2. Enable Channel Uplink & Downlink</h3>
2023-08-25 21:04:26 -07:00
Navigate to Channels > Primary: Turn on the sliders for **Uplink Enabled** and **Downlink Enabled** - Click the **Save** icon.
2023-08-25 20:30:14 -07:00
2023-09-11 20:56:30 -07:00
[![Channel Settings](/img/modules/mqtt/web_channel_sm.png)](/img/modules/mqtt/web_channel.png)
2023-08-25 20:30:14 -07:00
<h3>3. Configure Network Settings</h3>
2023-08-25 21:04:26 -07:00
Navigate to Config > Device Config > Network: Turn on the slider for **Enabled** - Enter your **SSID** and **PSK** for your network - Click the **Save** icon.
2023-08-25 20:30:14 -07:00
2023-09-11 20:56:30 -07:00
[![Network Settings](/img/modules/mqtt/web_network_sm.png)](/img/modules/mqtt/web_network.png)
2023-08-25 20:30:14 -07:00
</TabItem>
</Tabs>