PyPortal_LIFX_Controller: get LIFX_TOKEN from settings.toml
This commit is contained in:
parent
76cd05be8f
commit
7e8150b210
1 changed files with 4 additions and 9 deletions
|
|
@ -9,6 +9,8 @@ https://learn.adafruit.com/pyportal-smart-lighting-controller
|
|||
|
||||
Brent Rubell for Adafruit Industries, 2019
|
||||
"""
|
||||
import os
|
||||
|
||||
import board
|
||||
import displayio
|
||||
from adafruit_bitmap_font import bitmap_font
|
||||
|
|
@ -24,13 +26,6 @@ from adafruit_esp32spi import adafruit_esp32spi_wifimanager
|
|||
# import lifx library
|
||||
import adafruit_lifx
|
||||
|
||||
# Get wifi details and more from a secrets.py file
|
||||
try:
|
||||
from secrets import secrets
|
||||
except ImportError:
|
||||
print("WiFi secrets are kept in secrets.py, please add them there!")
|
||||
raise
|
||||
|
||||
# ESP32 SPI
|
||||
esp32_cs = DigitalInOut(board.ESP_CS)
|
||||
esp32_ready = DigitalInOut(board.ESP_BUSY)
|
||||
|
|
@ -47,9 +42,9 @@ ts = adafruit_touchscreen.Touchscreen(board.TOUCH_XL, board.TOUCH_XR,
|
|||
calibration=((5200, 59000), (5800, 57000)),
|
||||
size=(320, 240))
|
||||
|
||||
# Set this to your LIFX personal access token in secrets.py
|
||||
# Set this to your LIFX personal access token in settings.toml
|
||||
# (to obtain a token, visit: https://cloud.lifx.com/settings)
|
||||
lifx_token = secrets['lifx_token']
|
||||
lifx_token = os.getenv("LIFX_TOKEN")
|
||||
|
||||
# Initialize the LIFX API Helper
|
||||
lifx = adafruit_lifx.LIFX(wifi, lifx_token)
|
||||
|
|
|
|||
Loading…
Reference in a new issue