meshtastic/docs/settings/config/wifi.mdx
2022-09-22 17:17:02 -04:00

224 lines
6.1 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
id: network
title: Network Configuration
sidebar_label: Network
---
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
The Network config options are: WiFi Enabled, WiFi Mode, WiFi SSID, WiFi PSK, and NTP Server. Network config uses an admin message sending a `Config.Network` protobuf.
:::info
Enabling WiFi will disable bluetooth. Only one connection method will work at a time.
:::
ESP32 devices have the ability to connect to WiFi as a client and also are able to create a software based access point (SoftAP). WiFi can be configured in either mode.
You can [force the device to boot into SoftAP mode](#software-access-point) by rebooting the device with the program switch depressed. If forced into AP mode, it will revert to previous settings after a reboot. The device can be either a WiFi client or a software access point. It **cannot** operate as both at the same time.
## Network Config Values
### NTP Server
Type: **string**
Default: `0.pool.ntp.org`
The NTP server used if WiFi is conneced.
### Wifi Enabled
Type: **bool**
Default: `false` (Disabled)
Enables and Disables WiFi.
### WiFi SSID
Type: **string** (Case Sensitive)
Default: `""` (Empty)
In [SoftAP](#software-access-point) mode, this is the SSID broadcast to access your device's WiFi.
In [Client](#wifi-client) mode, this is your WiFi Networks SSID.
### WiFi PSK
Type: **string** (Case Sensitive)
Default: `""` (Empty)
In [SoftAP](#software-access-point) mode, this is the password to access your device's WiFi.
In [Client](#wifi-client) mode, this is your WiFi Networks password.
### WiFi Mode
Type: **enum**
Default: `Client`
#### Acceptable values
| Value | Description |
| :-------: | :--------------------------: |
| `CLIENT` | Client |
| `ACCESS_POINT` | [Software Access Point](#software-access-point) |
| `ACCESS_POINT_HIDDEN` | Software Access Point (Hidden) |
:::tip
The first time your device restarts after enabling the WiFi access point, it will take an additional 20-30 seconds to boot. This is to generate self-signed SSL keys. The keys will be saved for future reuse.
:::
## Network Config Client Availability
<Tabs
groupId="settings"
defaultValue="flasher"
values={[
{label: 'Android', value: 'android'},
{label: 'Apple', value: 'apple'},
{label: 'CLI', value: 'cli'},
{label: 'Flasher', value: 'flasher'},
{label: 'Web', value: 'web'},
]}>
<TabItem value="android">
:::info
Network config is not available for Android.
:::
</TabItem>
<TabItem value="apple">
:::info
Network config is not available on Apple OS's.
:::
</TabItem>
<TabItem value="cli">
All Network config options are available in the python CLI.
| Setting | Acceptable Values | Default |
| :-----------: | :---------------: | :-----: |
| network.ntp_server | string | `0.pool.ntp.org` |
| network.wifi_enabled | `true`, `false` | `false` |
| network.wifi_psk | string | `""` |
| network.wifi_ssid | string | `""` |
| network.wifi_mode | `CLIENT`, `ACCESS_POINT`, `ACCESS_POINT_HIDDEN` | `CLIENT` |
```shell title="Set NTP Server"
meshtastic --set network.ntp_server "0.pool.ntp.org"
```
```shell title="Enable / Disable WiFi"
meshtastic --set network.wifi_enabled true
meshtastic --set network.wifi_enabled false
```
```shell title="Make Access Point Hidden"
meshtastic --set network.wifi_mode ACCESS_POINT_HIDDEN
```
```shell title="Set WiFi SSID"
meshtastic --set network.wifi_ssid mynetwork
// With spaces
meshtastic --set network.wifi_ssid "my network"
```
```shell title="Set WiFi password"
meshtastic --set network.wifi_psk mypassword
// With spaces
meshtastic --set network.wifi_psk "my password"
```
</TabItem>
<TabItem value="flasher">
:::info
All Network config options are available in the Flasher.
:::
</TabItem>
<TabItem value="web">
:::info
All Network config options are available in the Web UI.
:::
</TabItem>
</Tabs>
## Examples
### Software Access Point
With the SoftAP enabled, a DNS server will run on the device. The DNS server will respond to all DNS requests with the IP address of your device. This will simplify device discovery because you will not have to remember the device's IP any unencrypted HTTP request will direct you to the right location.
If you set your SoftAP up using a client like the CLI and have a screen attached to your device, the final page will display something similar to the following:
```
WiFi: Software AP
IP: 192.168.42.1 (0/4)
SSID: myNetwork / PWD: myPassword (alternating)
http://meshtastic.local
* * * * *
```
You should then be able to connect to the node using either the displayed IP address or the HTTP link.
#### Force SoftAP
You can also enable the SoftAP by following these directions:
- Hold down the user button
- Press and release the reset button
- Count to two
- Let go of the user button
This will reboot the device with the SSID set to `meshtasticAdmin` and the password set to `12345678`. Using the Force SoftAP method, once you reboot, the SoftAP will be turned off.
If you have a screen attached to your device, the final page will display something similar to the following:
```
WiFi: Software AP (Admin)
IP: 192.168.42.1 (0/4)
SSID: meshtasticAdmin / PWD: 12345678 (alternating)
http://meshtastic.local
* * * * *
```
You should then be able to connect to the node using either the displayed IP address or the HTTP link.
### WiFi Client
With `network.wifi_ssid` & `network.wifi_psk` populated, the device will know to connect to your network. Make sure you are in range of your WiFi. If you have a single device on your local network it's easy to connect to your device `http://meshtastic.local`. If you have multiple devices you will need to connect using their respective IP addresses.
If you have a screen attached to your device, the final page will display something similar to the following:
```
WiFi: Software AP (Admin)
IP: 192.168.42.1 (0/4)
SSID: myNetwork
http://meshtastic.local
* * * * *
```
You should then be able to connect to the node using either the displayed IP address or the HTTP link.
### Disable WiFi
To disable WiFi completely, set `network.wifi_enabled` to `false`.