- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我已在 AWS IoT 上将我的 ESP32 注册为一个事物,并下载了其各自的证书以及公钥和私钥。还通过我终端中的以下命令验证了这些连接是否正确:
openssl s_client -connect host.iot.region.amazonaws.com:8443 -CAfile AmazonRootCA1.pem -cert certificate.pem.crt -key private.pem.key
这是我使用 MicroPython 连接到 AWS IoT 的(main.py)简单代码
import machine
from network import WLAN
import network
from umqtt.simple import MQTTClient
# AWS endpoint parameters.
HOST = b'HOST' # ex: b'abcdefg1234567'
REGION = b'REGION' # ex: b'us-east-1'
CLIENT_ID = "CLIENT_ID" # Should be unique for each device connected.
AWS_ENDPOINT = b'%s.iot.%s.amazonaws.com' % (HOST, REGION)
keyfile = '/certs/private.pem.key'
with open(keyfile, 'r') as f:
key = f.read()
certfile = "/certs/certificate.pem.crt"
with open(certfile, 'r') as f:
cert = f.read()
# SSL certificates.
SSL_PARAMS = {'key': key,'cert': cert, 'server_side': False}
# Setup WiFi connection.
wlan = network.WLAN( network.STA_IF )
wlan.active( True )
wlan.connect( "SSID", "PASSWORD" )
while not wlan.isconnected():
machine.idle()
# Connect to MQTT broker.
mqtt = MQTTClient( CLIENT_ID, AWS_ENDPOINT, port = 8883, keepalive = 10000, ssl = True, ssl_params = SSL_PARAMS )
mqtt.connect()
# Publish a test MQTT message.
mqtt.publish( topic = 'test', msg = 'hello world', qos = 0 )
但是当我尝试连接时出现此错误:
(-17168, 'MBEDTLS_ERR_RSA_PRIVATE_FAILED+MBEDTLS_ERR_MPI_ALLOC_FAILED')
最佳答案
经过一番努力,我得到了这个工作。我不得不使用 idf3 MicroPython 二进制文件,
esp32-idf3-20191220-v1.12.bin
v1.12 之后的 idf4 二进制文件和 idf3 不起作用。存在堆不足和内存分配问题。
关于mqtt - ESP32 - 使用 MicroPython 的 MQTT 到 AWS IoT,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/65960193/
我想知道如果我只连接到 MQTT 服务器(不发送或接收任何消息),一个月内(大约)会消耗多少数据。 我需要计算它来衡量我应该为物联网应用程序中使用的 sim 卡充值什么数据计划。 谢谢 最佳答案 编辑
对于单个消息,在 mqtt 中向主题(代理或接收器)发送(发布)数据是否有任何限制? 提前致谢.. 最佳答案 IBM 写了一个 article关于 MQTT。 A payload up to 256
我一直在阅读有关 MQTT 的资料,我知道它使用 TCP 进行网络传输。因此,如果我有一个将发送订阅请求的移动应用程序,我假设这将是一个全双工连接,以便客户端可以收到传入推送数据的通知。 那么如何提高
最近看了一篇物联网文章 http://www.eclipse.org/community/eclipse_newsletter/2014/february/article2.php 在这里他说,通过
我有一个项目涉及与众多客户进行后端通信。我正在寻找要使用的最佳协议(protocol)。 MQTT 适合我的项目吗? 最佳答案 Mqtt 最适合涉及大量用户的项目。目标是提供一个围绕发布/订阅模型优化
是否允许在 MQTT 主题中使用多个 #? 例如: sensors/data/#/something/else/# 最佳答案 没有 MQTT 规范(v3 和 v5)规定主题只能在主题中使用一次“#”,
如果 MQTT 已经是一个轻量级协议(protocol),而且它使用的功率和带宽很少,那么为什么我们有 MQTT-SN?什么时候适合使用 MQTT,什么时候适合使用 MQTT-SN? 最佳答案 与 M
我正在使用 Paho 和 Mosqitto 进行 MQTT 通信。我们必须支持两种序列化模型——xml 和 json。所以我正在寻找如何识别 MQTT 中的内容类型或有效负载类型。 MQTT 中是否有
我想知道消息发送顺序是否被保留。也就是说,当发布者发送消息序列时,是否保证每个订阅者收到与发布者发送的序列相同的序列?对于干净和持久的 session ? 最佳答案 MQTT 3.1.1 中消息排序功
我正在使用 Paho 和 Mosqitto 进行 MQTT 通信。我们必须支持两种序列化模型——xml 和 json。所以我正在寻找如何识别 MQTT 中的内容类型或有效负载类型。 MQTT 中是否有
我已经在我的本地机器上安装了 MQTT 的 mosquitto 客户端。 我有以下配置: listener 1883 protocol mqtt listener 9001 protocol webs
MQTT 客户端每分钟轮询服务器多少次?是不是大数据流量?我知道数据包的大小可以很小,但是客户端 ping 代理多少次才能使自己在代理中“在线”。 如果我不清楚,请评论这个问题,我会尝试更好地解释我的
我们在不同的场所安装了许多本地网关。这些网关将托管一个 MQTT 代理,用于连接所有本地服务。然后需要本地 MQTT 代理将此数据发送到两个远程 MQTT 代理(每个托管于不同的一方)。我已阅读有关
无论我做什么,我都无法在我的 angular 应用程序中通过 websocket 连接到 mqtt 代理(在 chrome 和 firefox 中尝试)。 为简单起见,我使用 HiveMQ broke
我有一个 MQTT 客户端想要订阅以下主题 node1/数据/更新 节点1/数据/增量 节点1/数据 当然我有多个节点,所以我必须使用通配符,如下所述:https://www.hivemq.com/b
我正在使用 mosquitto (http://mosquitto.org/) 作为 MQTT 代理,并正在寻找有关负载平衡订阅者的建议(针对同一主题)。这是如何实现的?我读到的关于协议(protoc
如题,我可以区分新的和保留的MQTT消息吗?以及如何知道客户端何时发布消息?所有这些没有在主题或消息中指定时间戳字符串。 最佳答案 客户端使用保留标志向代理指示代理应将消息保留为要发布到的主题的“最后
有什么方法可以从另一个客户端找到所有连接的客户端详细信息(IP 和名称)?我知道有一个主题“$SYS/broker/clients/active”给出了当前连接的客户端的数量,但是如果我想了解更多关于
当处于 QOS 1 和 2 时,它会重播所有过去的消息。标准实现中是否有一种方法可以在再次生效时接收整个过去的队列(作为数组)? (当然仅限订阅的) 最佳答案 当客户端以 QOS 1 或 2 订阅主题
我想连接一个客户端,该客户端将监视代理的所有主题,以便在我不知道主题名称是什么时响应事件。 最佳答案 订阅 # 可以让您订阅除以 $ 开头的主题之外的所有内容(无论如何,这些主题通常都是控制主题)。
我是一名优秀的程序员,十分优秀!