IoT thing auto reconnect using python SDK

0

Using AWS Python SDK, I am communicating with the IoT thing which has a sensor device connected. I am utilizing the MQTT for sending the message to IoT and writing the sensor data to IoT shadow. In the connection code, I have configured the configureAutoReconnectBackoffTime to restablish the connection automatically.

whenever network goes, the callback return "REQEUST TIME OUT". When the network comes back, it automatcilly writes the data to IoT Shadow. But sometimes, it takes more time to reestablish the connection. Many times the network is up and I am getting the response from ping. But it takes more time to reconnect. I increased the maxReconnectQuietTimeSecond time in configureAutoReconnectBackoffTime, still I am getting the same error.

I am using the below lines in the IoT connection code.

    Iot_connection = AWSIoTMQTTShadowClient(clientId)
    Iot_connection.configureEndpoint(host, 8883)
    Iot_connection.configureCredentials("{}AmazonRootCA1.pem".format(certPath), "{}iot_private.key".format(certPath), "{}iot_cert.crt".format(certPath))
    Iot_connection.configureAutoReconnectBackoffTime(1, 6, 5)
    Iot_connection.configureConnectDisconnectTimeout(5)
  • Hi, have you tried connecting without invoking configureAutoReconnectBackoffTime and configureConnectDisconnectTimeout to see if it works? This would be helpful to troubleshoot whether you have either issues with your certificates or with the IoT Thing Policy associated with your certificates. Also, while you're at it, please share the IoT Thing Policy attached to your certificates so we can rule out any other required configuration there.

  • David, I am connecting without invoking the configureAutoReconnectBackoffTime and configureConnectDisconnectTimeout. In the meantime, please find the policy attached to the IoT

    { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": "iot:", "Resource": "" } ] }

질문됨 2년 전88회 조회
답변 없음

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인