Skip to content

Fix invalid secret lookup #12

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

Merged
merged 1 commit into from
Feb 25, 2025
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
2 changes: 1 addition & 1 deletion adafruit_esp32s2tft/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ class ESP32S2TFT(PortalBase):
:param scale: Default scale is 1, but can be an integer of 1 or greater
:param debug: Turn on debug print outs. Defaults to False.
:param use_network: Enable network initialization. Defaults to True.
Setting to False will allow you to use the library without a secrets.py
Setting to False will allow you to use the library without a settings.toml
file with wifi configuration in it.

"""
Expand Down
13 changes: 6 additions & 7 deletions adafruit_esp32s2tft/network.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,13 +73,12 @@ def __init__(

def init_io_mqtt(self) -> IO_MQTT:
"""Initialize MQTT for Adafruit IO"""
try:
aio_username = self._secrets["aio_username"]
aio_key = self._secrets["aio_key"]
except KeyError:
raise KeyError(
"Adafruit IO secrets are kept in secrets.py, please add them there!\n\n"
) from KeyError
aio_username = self._get_setting["ADAFRUIT_AIO_USERNAME"]
aio_key = self._get_setting["ADAFRUIT_AIO_KEY"]
if None in [aio_username, aio_key]:
raise AttributeError(
"Adafruit IO keys are kept in settings.toml, please add them there."
)

return self.init_mqtt(IO_MQTT_BROKER, 8883, aio_username, aio_key, True)

Expand Down
1 change: 0 additions & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
"ssl",
"wifi",
"socketpool",
"secrets",
"bitmaptools",
]

Expand Down