ラズベリーにモスキートブローカーがあり、アマゾンIoTサービスとブリッジされています。 https://aws.amazon.com/es/blogs/iot/how-to-bridge-mosquitto-mqtt-broker-to-aws-iot/永続性を使用してmosquitto MQTTブローカーからアマゾンIoTサービスへ
は、これは私のmosquitto.confファイルです:
# Place your local configuration in /etc/mosquitto/conf.d/
#
# A full description of the configuration file is at
# /usr/share/doc/mosquitto/examples/mosquitto.conf.example
pid_file /var/run/mosquitto.pid
persistence true
persistence_location /var/lib/mosquitto/
log_dest file /var/log/mosquitto/mosquitto.log
include_dir /etc/mosquitto/conf.d
これは、すべてが正常に動作します
# =================================================================
# Bridges to AWS IOT
# =================================================================
# AWS IoT endpoint, use AWS CLI 'aws iot describe-endpoint'
connection awsiot
address xxxxxxxxx.iot.eu-central-1.amazonaws.com:8883
# Specifying which topics are bridged
topic awsiot_to_localgateway in 1
topic localgateway_to_awsiot/iot out 1
topic both_directions both 1
# Setting protocol version explicitly
bridge_protocol_version mqttv311
bridge_insecure false
# Bridge connection name and MQTT client Id,
# enabling the connection automatically when the broker starts.
cleansession true
clientid bridgeawsiot
start_type automatic
notifications false
log_type all
# =================================================================
# Certificate based SSL/TLS support
# -----------------------------------------------------------------
#Path to the rootCA
bridge_cafile /etc/mosquitto/certs/rootCA.pem
# Path to the PEM encoded client certificate
bridge_certfile /etc/mosquitto/certs/cert.crt
# Path to the PEM encoded client private key
bridge_keyfile /etc/mosquitto/certs/private.key
/etc/mosquitto/conf.dの内側にあるbridge.confです。しかし、もし私が辛抱強さをテストするためにイーサネットケーブルを取り外すならば。通信が再確立されたとき。ブローカはamazon IoTサービスに繰り返しメッセージを送信します。
これは私が
char dataToSend[] = "Message Id: ";
counter++;
snprintf(dataToSend, sizeof(dataToSend) + 10, "Message Id: %d", counter);
app_mqtt_publish(&dataToSend);
を送っていたメッセージであるが、それは正常な動作ですか?
この設定では、ブリッジの詳細を含めていません。また、どのような種類のメッセージを送信していますか、どのようなQOSが保持されていますか? – hardillb
申し訳ありません@hardillb ...質問が編集されました。 QOSは1です。 – JosepB