Omega2 aws connect error, SSL certificate verify failed
-
Thanks, after doing the describe process i think Certification issue got solved. But new problem i can see. Please can help to fix this.
-
@Suman-kumar-Jha
This is a bit beyond my skills as I don't python much and don't AWS or MQTT at all, so perhaps someone else can get you to the answer much quicker than I can.However, looking at the error you posted, it looks like you are getting a timeout while trying to publish.
Perhaps you need to increase the timeout duration?
A bit of google searching reveals that there are a couple of timeout settings that can be tweaked (.configureConnectDisconnectTimeout() and .configureMQTTOperationTimeout()), perhaps you need to look into those?There's also this open issue on the aws iot python sdk (which I assume you are using): Recommendation on handling publishTimeoutException #211
-
Thank you cas for your kind support.
I have Omega2
Firmware : omega2-v0.3.2-b230I had installed python 2.7.9
Checked SSL Version: 1.0.2
Then downloaded AWS SDK package for python
Followed this link https://onion.io/2bt-aws-iot-setup-single-command/ for setting up AWS for Omega2Tested manual publish using link
mosquitto_pub -t $aws/things/Omega-CF2D/shadow/update -m '{"state": {"desired": {"Hi": "Suman"}}}' -q 1
It worked.Then i had looked for python program that can take sensor data from Omega Arduino dock 2 and publish to AWS topic.
I got the from Linkit 7688 duo aws example, python code. I had modified it. modified program i had attached already before.
After running i got error which i posted here
Please help anyone
-
Hi cas,
I had made simple python program to upload static test data to AWS, everything went correct no error. On AWS IoT core under my thing test, i subscribed to the published topic.
But then also not able to see any update. Kindly help.here is the code
print("Importing Library") import time import sys import datetime import paho.mqtt.client as paho import ssl import os import json print("Importing Done") def on_connect(client, userdata, flags, rc): global connflag connflag = True if rc == 0: print("Connected") else: print("Connection returned result: " + str(rc) ) def on_message(client, userdata, msg): print(msg.topic+" "+str(msg.payload)) mqttc = paho.Client("myOmega") mqttc.on_connect = on_connect mqttc.on_message = on_message print("Paho Client Setup Done") awshost = "a3rzs5flqm8tjk-ats.iot.ap-south-1.amazonaws.com" awsport = 8883 clientId = "myOmega" thingName = "Omega-CF2D" caPath = "/root/root-CA.crt" certPath = "/root/496d95a10e-certificate.pem.crt" keyPath = "/root/496d95a10e-private.pem.key" mqttc.tls_set(caPath, certfile=certPath, keyfile=keyPath, cert_reqs=ssl.CERT_REQUIRED, tls_version=ssl.PROTOCOL_TLSv1_2, ciphers=None) print("TLS Established") mqttc.connect(awshost, awsport, keepalive=60) print("Server Connected") mqttc.loop_start() while True: humidity = 60 temperature = 30 print "humidity: %d, temperature: %d" % (float(humidity), float(temperature)) t = time.time(); date = datetime.datetime.fromtimestamp(t).strftime('%Y%m%d%H%M%S') mqttc.publish("$aws/things/Omega-CF2D/shadow/update/", json.dumps({"time": date, "temperature": temperature, "humidity": humidity}), qos=1) time.sleep(10)
Code Output
-
Hey,
Anyone will help
-
@Suman-kumar-Jha have you implemented the on_log callback? I would also implement the on_publish callback. I have not used paho for a few years and I used the C based client but these callbacks are your friend. I'm not entirely convinced that your print statements accurately represent the state of the process.
-
Thanks crispyoz, I had put on_log, then found mqtt is not connecting itself, because of certificate of AWS. Then i followed Mr. Steves turorial and made SSL MQTT working with Cloudmqtt
http://www.steves-internet-guide.com/create-mqtt-broker-cloudmqtt/Thanks for the support
-
@Suman-kumar-Jha Hi sorry I'm having some problems like you, I was wondering what it's the file named caPath = "/root/root-CA.crt" o where is in. into the page AWS. I would really appreciate if you can help me with the doubt.
-
@Victor-Lucio The RootCA is a certificate that you can download from Amazon.
See these resources:
https://docs.aws.amazon.com/iot/latest/developerguide/create-device-certificate.html
https://onion.io/2bt-aws-iot-setup-single-command/
-
@Lazar-Demin Hi thanks for responding I tried 2 days ago send the data following the steeps in the link, but he doesn't use the CA certificate. At momment that I clic in the option "download" the CA certificate in this link https://docs.aws.amazon.com/iot/latest/developerguide/create-device-certificate.html. Sends to this page. https://docs.aws.amazon.com/iot/latest/developerguide/server-authentication.html#server-authentication-certs
In this page. I use the Amazon Root A1, but I don't know if it's correct to use.