Skip to content

Commit 7e8150b

Browse files
authored
PyPortal_LIFX_Controller: get LIFX_TOKEN from settings.toml
1 parent 76cd05b commit 7e8150b

1 file changed

Lines changed: 4 additions & 9 deletions

File tree

  • PyPortal/PyPortal_LIFX_Controller

PyPortal/PyPortal_LIFX_Controller/code.py

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
1010
Brent Rubell for Adafruit Industries, 2019
1111
"""
12+
import os
13+
1214
import board
1315
import displayio
1416
from adafruit_bitmap_font import bitmap_font
@@ -24,13 +26,6 @@
2426
# import lifx library
2527
import adafruit_lifx
2628

27-
# Get wifi details and more from a secrets.py file
28-
try:
29-
from secrets import secrets
30-
except ImportError:
31-
print("WiFi secrets are kept in secrets.py, please add them there!")
32-
raise
33-
3429
# ESP32 SPI
3530
esp32_cs = DigitalInOut(board.ESP_CS)
3631
esp32_ready = DigitalInOut(board.ESP_BUSY)
@@ -47,9 +42,9 @@
4742
calibration=((5200, 59000), (5800, 57000)),
4843
size=(320, 240))
4944

50-
# Set this to your LIFX personal access token in secrets.py
45+
# Set this to your LIFX personal access token in settings.toml
5146
# (to obtain a token, visit: https://cloud.lifx.com/settings)
52-
lifx_token = secrets['lifx_token']
47+
lifx_token = os.getenv("LIFX_TOKEN")
5348

5449
# Initialize the LIFX API Helper
5550
lifx = adafruit_lifx.LIFX(wifi, lifx_token)

0 commit comments

Comments
 (0)