Skip to content

Commit

Permalink
Merge pull request #31 from wizzdev-pl/devel
Browse files Browse the repository at this point in the history
Merge devel to master
  • Loading branch information
damian-kurek-wizzdev authored Sep 2, 2021
2 parents 85b29ab + 652d206 commit 45983b5
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 12 deletions.
2 changes: 1 addition & 1 deletion MicroPython/scripts/register_device.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ def parse_arguments():

parser.add_argument('-c', '--cloud', metavar='CLOUD', type=str, required=True,
help="Cloud provider for IoT Starter: {}".format(
Providers.print_providers()))
Providers.THINGSBOARD))

args = vars(parser.parse_args())
return args
Expand Down
6 changes: 0 additions & 6 deletions MicroPython/src/cloud/AWS_cloud.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ def device_configuration(self, data: list[dict]) -> int:
try:
utils.connect_to_wifi(wireless_controller, data)
logging.info(wireless_controller.sta_handler.ifconfig())
self.configure_aws_thing()
config.cfg.access_points = data
except Exception as e:
logging.error("Exception caught: {}".format(e))
Expand Down Expand Up @@ -227,11 +226,6 @@ def publish_data(self, data) -> None:
sync_time=False
)

certificates_existence, *_ = self.read_certificates()
if not certificates_existence:
logging.debug("No AWS Certificates, configure_aws_thing()")
self.configure_aws_thing()

logging.debug("data to send = {}".format(data))
logging.info(config.cfg.aws_topic)
result = mqtt_communicator.publish_message(payload=data, topic=config.cfg.aws_topic,
Expand Down
12 changes: 8 additions & 4 deletions MicroPython/src/data_upload/mqtt_communicator.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,14 @@ def __init__(self,

if cloud_provider == Providers.AWS:
# Secure socket layer MQTT communication

result, aws_certificate, aws_key = AWS_cloud.read_certificates(
True)
if not result:
certificates_existence, aws_certificate, aws_key = AWS_cloud.read_certificates(True)
if not certificates_existence:
logging.debug("No AWS Certificates, configure_aws_thing()")
aws = AWS_cloud()
aws.configure_aws_thing()
certificates_existence, aws_certificate, aws_key = AWS_cloud.read_certificates(True)

if not certificates_existence:
raise Exception("Failed to read AWS certificate or key")

ssl_parameters = {
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ Make sure you have access to required hardware:
- **(For AWS only)** Account with ACCESS_CODE and SECRET_CODE - [more info](https://github.com/wizzdev-pl/iot-starter/blob/devel/terraform/README.md#Additional-information-and-help)
- ESP32 MCU board (preferably ESP32 DevKitC v4)
- MicroUSB cable
- DHT11 or DHT22 sensor with cables (additional 10k pull-up resistor may be needed) or BME280
- DHT11 or DHT22 sensor with cables (additional 10k pull-up resistor may be needed) or BME280 (IMPORTANT! Default measurement pin for DHT sensors is 27! BME280 uses pins 21 as SCL and 22 as SDA)
- WiFi connection


Expand Down

0 comments on commit 45983b5

Please sign in to comment.