Skip to content

Commit 1a3e2a3

Browse files
authored
Merge pull request #2 from brentru/fix-esp32spi-method-names
Fix incorrect attribute name, rm certificates.py
2 parents 8dc74f4 + cd75b5c commit 1a3e2a3

File tree

4 files changed

+25
-56
lines changed

4 files changed

+25
-56
lines changed

adafruit_aws_iot.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ def __init__(self, mmqttclient, keep_alive=30):
7979
# Shadow-interaction topic
8080
self.shadow_topic = "$aws/things/{}/shadow".format(self.cid)
8181
# Ensure set_certificate and set_private_key were run from ESP32SPI
82-
assert self.client.wifi.esp.set_psk and self.client.wifi.esp.set_cert, "Certificate \
82+
assert self.client.wifi.esp.set_psk and self.client.wifi.esp.set_crt, "Certificate \
8383
and private key must be set to your AWS Device Cert and Private Key."
8484
# keep_alive timer must be between 30 <= keep alive interval <= 1200 seconds
8585
# https://docs.aws.amazon.com/general/latest/gr/aws_service_limits.html

certificates.py

Lines changed: 0 additions & 47 deletions
This file was deleted.

examples/aws_iot_shadows.py

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,20 @@
1818
print("WiFi secrets are kept in secrets.py, please add them there!")
1919
raise
2020

21-
# Get device certificate and private key from a certificates.py file
21+
# Get device certificate
2222
try:
23-
from certificates import DEVICE_CERT, DEVICE_KEY
23+
with open("aws_cert.pem.crt", "rb") as f:
24+
DEVICE_CERT = f.read()
2425
except ImportError:
25-
print("Certificate and private key data is kept in certificates.py, \
26-
please add them there!")
26+
print("Certificate (aws_cert.pem.crt) not found on CIRCUITPY filesystem.")
27+
raise
28+
29+
# Get device private key
30+
try:
31+
with open("private.pem.key", "rb") as f:
32+
DEVICE_KEY = f.read()
33+
except ImportError:
34+
print("Certificate (private.pem.key) not found on CIRCUITPY filesystem.")
2735
raise
2836

2937
# If you are using a board with pre-defined ESP32 Pins:

examples/aws_iot_simpletest.py

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,20 @@
1818
print("WiFi secrets are kept in secrets.py, please add them there!")
1919
raise
2020

21-
# Get device certificate and private key from a certificates.py file
21+
# Get device certificate
2222
try:
23-
from certificates import DEVICE_CERT, DEVICE_KEY
23+
with open("aws_cert.pem.crt", "rb") as f:
24+
DEVICE_CERT = f.read()
2425
except ImportError:
25-
print("Certificate and private key data is kept in certificates.py, \
26-
please add them there!")
26+
print("Certificate (aws_cert.pem.crt) not found on CIRCUITPY filesystem.")
27+
raise
28+
29+
# Get device private key
30+
try:
31+
with open("private.pem.key", "rb") as f:
32+
DEVICE_KEY = f.read()
33+
except ImportError:
34+
print("Certificate (private.pem.key) not found on CIRCUITPY filesystem.")
2735
raise
2836

2937
# If you are using a board with pre-defined ESP32 Pins:

0 commit comments

Comments
 (0)