# WiFi Datalogger (MacSync) MQTT Setup

URL: https://www.macnman.com/docs/wifi/datalogger-wifi/macsync_wifi_server_mqtt
Section: User Manual › Wifi › Datalogger Wifi

# How to setup MQTT ?

The **MacSync Wi-Fi series** supports MQTT protocol for seamless communication with cloud servers and local brokers. Follow the steps below to configure your MQTT connection.

![trigger uplinks](/img/wifi/wifi_mqtt_setup.svg)

## Configuring Broker Settings

#### 1. Enter MQTT Host
   - Type the MQTT **Broker Hostname or IP Address**.
   - Example: `broker.hivemq.com` or `192.168.1.100`.

#### 2. Set Port Number
   - Enter the **Port** your broker uses.
     - Common examples:
       - `1883` for non-TLS
       - `8883` for TLS

#### 3. Enter Username
   - Provide the **MQTT username** if authentication is enabled on the broker.
   - Leave blank if not required.

#### 4. Enter Password
   - Input the corresponding **password** for the above username.
   - The input field is masked for security.

#### 5. Validate Server Certificate (Toggle)
   - Use the **Validate Certificate toggle** to enable/disable server certificate verification.
     - **ON**: Ensures the broker uses a valid certificate (recommended for production).
     - **OFF**: Skips validation (useful for local/dev environments).

#### 6. Enable TLS (Toggle)
   - Turn this **ON** to enable TLS encryption (for secure connections).
   - Keep it **OFF** for plain MQTT over port `1883`.

## Add Publish Topic

- Define the topic where **MacSync will publish data**.
- Example:  
  - `macsync/device123/data`  
  - This could include sensor readings or event messages.

## Add Subscribe Topic

- Set the topic to **receive commands or configuration**.
- Example:  
  - `macsync/device123/cmd`  
  - Useful for OTA commands, remote configuration, or toggling relays.

## Testing & Save

- Once all fields are filled:
  - Click the **"Test Connection"** button (if available).
  - Review connection status.
- Hit **“Save”** to apply the MQTT settings.

## Sample Configuration

| Field                 | Example Value                |
|-----------------------|------------------------------|
| Host                  | `mqtt.example.com`           |
| Port                  | `8883`                       |
| Username              | `macsync_user`               |
| Password              | `********`                   |
| Validate Certificate  | ON                           |
| Enable TLS            | ON                           |
| Publish Topic         | `macsync/device001/data`     |
| Subscribe Topic       | `macsync/device001/control`  |

## Related Resources

- Datasheet: [MacSync-WX1-PO RS485 and analog to Wi-Fi data logger datasheet](/product/wifi/dataloggers/macsync-w-power-operated-x-two)
- Datasheet: [MacSync-WX1-BO battery-operated RS485 and analog to Wi-Fi data logger datasheet](/product/wifi/dataloggers/macsync-l-std-battery-operated-gen-one)
- Start of this manual: [WiFi Datalogger (MacSync) Introduction](/wifi/datalogger-wifi/macsync_rs485_wifi_introduction)
- Help: [Contact Macnman support](/help/help)
