Skip to content

MQTT 凭据#

¥MQTT credentials

你可以使用以下凭据验证以下节点:

¥You can use these credentials to authenticate the following nodes:

¥MQTT Trigger

先决条件#

¥Prerequisites

安装 MQTT 代理

¥Install an MQTT broker.

MQTT 在 MQTT 软件 提供服务器/代理列表。

¥MQTT provides a list of Servers/Brokers at MQTT Software.

支持的身份验证方法#

¥Supported authentication methods

  • 代理连接

¥Broker connection

相关资源#

¥Related resources

有关 MQTT 协议的更多信息,请参阅 MQTT 文档

¥Refer to MQTT's documentation for more information about the MQTT protocol.

请参阅你的代理提供商的文档,了解有关更详细的配置和详细信息。

¥Refer to your broker provider's documentation for more detailed configuration and details.

使用代理连接#

¥Using broker connection

要配置此凭据,你需要:

¥To configure this credential, you'll need:

  • 你的 MQTT 代理协议

¥Your MQTT broker's Protocol

  • 主机

¥The Host

  • 端口

¥The Port

  • 用于身份验证的用户名和密码。

¥A Username and Password to authenticate with

  • 如果你使用 SSL,请提供相关的证书和密钥。

¥If you're using SSL, the relevant certificates and keys

设置事项:

¥To set things up:

  1. 选择代理的协议,该协议决定了 n8n 使用的 URL。选项包括:

¥Select the broker's Protocol, which determines the URL n8n uses. Options include:

  • MQTT:URL 开头应使用标准的 mqtt: 协议。

    ¥Mqtt: Begin the URL with the standard mqtt: protocol.

  • MQTTs:URL 以安全的 mqtts: 协议开头。

    ¥Mqtts: Begin the URL with the secure mqtts: protocol.

  • 工作流:URL 以 WebSocket ws: 协议开头。

    ¥Ws: Begin the URL with the WebSocket ws: protocol. 2. 输入你的代理主机。

¥Enter your broker Host. 3. 输入 n8n 用于连接到代理主机的端口号。

¥Enter the Port number n8n should use to connect to the broker host. 4. 输入登录代理的用户名。

¥Enter the Username to log into the broker as. 5. 输入该用户的密码。

¥Enter that user's Password. 6. 如果你想在离线状态下接收 QoS 1 和 QoS 2 消息,请关闭“清理会话”开关。

¥If you want to receive QoS 1 and 2 messages while offline, turn off the Clean Session toggle. 7. 输入你希望凭据使用的客户 ID。如果你将其留空,n8n 将为你生成一个模板。你可以使用固定的客户端 ID 或基于表达式的客户端 ID。

¥Enter a Client ID you'd like the credential to use. If you leave this blank, n8n will generate one for you. You can use a fixed or expression-based Client ID.

  • 客户端 ID 可用于识别和跟踪连接访问。n8n 建议使用包含 n8n 的名称,以便于审计。

    ¥Client IDs can be useful to identify and track connection access. n8n recommends using something with n8n in it for easier auditing. 8. 如果你的 MQTT 代理使用 SSL,请启用 SSL 开关。启用后:

¥If your MQTT broker uses SSL, turn the SSL toggle on. Once you turn it on: 1. 选择是否使用无密码证书连接(类似于 SASL 机制,外部)。如果已启用:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
  ¥Select whether to use **Passwordless** connection with certificates, which is like the SASL mechanism EXTERNAL. If turned on:
  1. 选择是否拒绝未经授权的证书:如果关闭此选项,即使证书验证失败,n8n 也会连接。

     ¥Select whether to **Reject Unauthorized Certificate**: If turned off, n8n will connect even if the certificate validation fails.
  2. 添加一个 SSL 客户端证书。

     ¥Add an SSL **Client Certificate**.
  3. 为客户端证书添加一个 SSL 客户端密钥。

     ¥Add an SSL **Client Key** for the Client Certificate.
  1. 一个或多个 SSL CA 证书。

    ¥One or more SSL CA Certificates.

请参阅你的 MQTT 代理提供商的文档,了解有关更详细的配置说明。

¥Refer to your MQTT broker provider's documentation for more detailed configuration instructions.