Home/Support/Support Forum/Help Connecting Xbee Cellular to AWS console

Help Connecting Xbee Cellular to AWS console

0 votes
Folks,
I have tried continuously for the past week to connect my Digi Xbee3 Cellular LTE-M to the AWS Console. I think my problem is with the SSL certificate that is causing the socket.connect function to time out - but that is just a guess. I have reviewed other posts with a similar issue and tried all the recommendations: (removing -ats from the host name; using the Symantec legacy certificate, using the Starfield certificate, using new aws certificates, etc.). I keep getting the following error when using the micropython test code (aws-https.py) found at https://github.com/digidotcom/xbee-micropython:

MicroPython v1.9.4-927-g7565eb7 on 2018-11-08; XBC LTE-M/NB-IoT Global with EFR32MG
Type "help()" for more information.
>>>
paste mode; Ctrl-C to cancel, Ctrl-D to finish
1=== import usocket, ussl, time, network
2=== host = b'a11y05y0u5faak'
3=== region = b'us-west-2'
4=== thing_name = b'SWR_TestSensor_1'
5=== aws_endpoint = b'%s.iot.%s.amazonaws.com' % (host, region)
6=== ssl_params = {'keyfile': "/flash/cert/aws.key",
7=== 'certfile': "/flash/cert/aws.crt",
8=== 'ca_certs': "/flash/cert/cert.ca"}
9=== conn = network.Cellular()
10=== while not conn.isconnected():
11=== print("waiting for network connection...")
12=== time.sleep(4)
13=== print("network connected")
14=== def https_test(hostname=aws_endpoint, sslp=ssl_params):
15=== s = usocket.socket(usocket.AF_INET, usocket.SOCK_STREAM, usocket.IPPROTO_SEC)
16=== s.setblocking(False)
17=== w = ussl.wrap_socket(s, **ssl_params)
18=== print("connecting...")
19=== w.connect((hostname, 8443))
20=== print("connected")
21=== print("sending request")
22=== w.write(b'GET /things/%s/shadow HTTP/1.0\r\nHost: %s\r\n\r\n' % (thing_name, hostname))
23=== print("waiting for data...")
24=== while True:
25=== data = w.read(1024)
26=== if data:
27=== print(str(data, 'utf-8'))
28=== break
29=== w.close()
30=== print("DONE")
31=== https_test()
32===
network connected
Traceback (most recent call last):
File "<stdin>", line 31, in <module>
File "<stdin>", line 17, in https_test


Likewise, I get the following error codes when using the same source for testing an mqtt connection (aws-publish.py):

MicroPython v1.9.4-927-g7565eb7 on 2018-11-08; XBC LTE-M/NB-IoT Global with EFR32MG
Type "help()" for more information.
>>>
paste mode; Ctrl-C to cancel, Ctrl-D to finish
1=== from umqtt.simple import MQTTClient
2=== import time, network
3=== host = b'a11y05y0u5faak'
4=== region = b'us-west-2'
5=== aws_endpoint = b'%s.iot.%s.amazonaws.com' % (host, region)
6=== ssl_params = {'keyfile': "/flash/cert/aws.key",
7=== 'certfile': "/flash/cert/aws.crt",
8=== 'ca_certs': "/flash/cert/aws.ca"}
9=== conn = network.Cellular()
10=== while not conn.isconnected():
11=== print("waiting for network connection...")
12=== time.sleep(4)
13=== print("network connected")
14=== def publish_test(clientId="SWR_TestSensor_1", hostname=aws_endpoint, sslp=ssl_params):
15=== c = MQTTClient(clientId, aws_endpoint, ssl=True, ssl_params=sslp)
16=== print("connecting...")
17=== c.connect()
18=== print("connected")
19=== print("publishing message...")
20=== c.publish("sample/xbee", '{"message": "AWS Sample Message"}')
21=== print("published")
22=== c.disconnect()
23=== print("DONE")
24=== publish_test()
network connected
connecting...
Traceback (most recent call last):
File "<stdin>", line 24, in <module>
File "<stdin>", line 17, in publish_test
File "/flash/lib/umqtt/simple.py", line 72, in connect
OSError: [Errno 7005] EIO


I am new to using certificates but it seems to be where the problem is. Has anyone experienced similar issues and can provide some guidance? Or is there something in my code that doesn't look quite right? Thanks in advance!

Jon
asked Mar 21 in XBee Cellular by jgassett New to the Community (0 points)

Please log in or register to answer this question.

...