Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix AttributeError, set_socket #16

Merged
merged 2 commits into from
Aug 6, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions adafruit_gc_iot_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,9 @@ def __init__(self, mqtt_client):
if "MQTT" in mqtt_client_type:
self._client = mqtt_client
else:
raise TypeError("This class requires a MiniMQTT client object, please create one.")
raise TypeError(
"This class requires a MiniMQTT client object, please create one."
)
# Verify that the MiniMQTT client was setup correctly.
try:
self.user = self._client.user
Expand Down Expand Up @@ -324,7 +326,9 @@ def __init__(self, esp, secrets, log=False):
if hasattr(secrets, "keys"):
self._secrets = secrets
else:
raise AttributeError("Project settings are kept in secrets.py, please add them there!")
raise AttributeError(
"Project settings are kept in secrets.py, please add them there!"
)
self.logger = None
if log is True:
self.logger = logging.getLogger("log")
Expand Down
13 changes: 10 additions & 3 deletions examples/gc_iot_core_simpletest.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from adafruit_esp32spi import adafruit_esp32spi_wifimanager
import adafruit_esp32spi.adafruit_esp32spi_socket as socket

import adafruit_minimqtt as MQTT
import adafruit_minimqtt.adafruit_minimqtt as MQTT
from adafruit_gc_iot_core import Cloud_Core, MQTT_API

### WiFi ###
Expand All @@ -32,7 +32,9 @@
spi = busio.SPI(board.SCK, board.MOSI, board.MISO)
esp = adafruit_esp32spi.ESP_SPIcontrol(spi, esp32_cs, esp32_ready, esp32_reset)
"""Use below for Most Boards"""
status_light = neopixel.NeoPixel(board.NEOPIXEL, 1, brightness=0.2) # Uncomment for Most Boards
status_light = neopixel.NeoPixel(
board.NEOPIXEL, 1, brightness=0.2
) # Uncomment for Most Boards
"""Uncomment below for ItsyBitsy M4"""
# status_light = dotstar.DotStar(board.APA102_SCK, board.APA102_MOSI, 1, brightness=0.2)
# Uncomment below for an externally defined RGB LED
Expand Down Expand Up @@ -103,7 +105,12 @@ def message(client, topic, msg):
# print("Your JWT is: ", jwt)

# Set up a new MiniMQTT Client
client = MQTT.MQTT(broker=google_iot.broker, username=google_iot.username, password=secrets["jwt"], client_id=google_iot.cid,)
client = MQTT.MQTT(
broker=google_iot.broker,
username=google_iot.username,
password=secrets["jwt"],
client_id=google_iot.cid,
)

# Initialize Google MQTT API Client
google_mqtt = MQTT_API(client)
Expand Down