Skip to content

Commit

Permalink
Merge pull request #26 from justmobilize/remove-secrets
Browse files Browse the repository at this point in the history
Remove secrets
  • Loading branch information
dhalbert authored Feb 26, 2025
2 parents 8a5620c + 8eecc81 commit 4dcc5f6
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 16 deletions.
8 changes: 3 additions & 5 deletions examples/lifx_simpletest.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,11 @@

import adafruit_lifx

# Get WiFi details, ensure these are setup in settings.toml
# Get WiFi details and LIFX keys, ensure these are setup in settings.toml
# (to obtain a token, visit: https://cloud.lifx.com/settings)
ssid = getenv("CIRCUITPY_WIFI_SSID")
password = getenv("CIRCUITPY_WIFI_PASSWORD")
lifx_token = getenv("lifx_token")

# ESP32 SPI
esp32_cs = DigitalInOut(board.ESP_CS)
Expand All @@ -24,10 +26,6 @@
status_pixel = neopixel.NeoPixel(board.NEOPIXEL, 1, brightness=0.2)
wifi = WiFiManager(esp, ssid, password, status_pixel=status_pixel)

# Add your LIFX Personal Access token to secrets.py
# (to obtain a token, visit: https://cloud.lifx.com/settings)
lifx_token = getenv("lifx_token")

if lifx_token is None:
raise KeyError("Please add your lifx token to settings.toml")

Expand Down
18 changes: 7 additions & 11 deletions examples/lifx_simpletest_esp32s2.py
Original file line number Diff line number Diff line change
@@ -1,29 +1,25 @@
# SPDX-FileCopyrightText: 2021 ladyada for Adafruit Industries
# SPDX-License-Identifier: MIT

from os import getenv
import ssl
import wifi
import socketpool
import adafruit_requests

import adafruit_lifx

# Get wifi details and more from a secrets.py file
try:
from secrets import secrets
except ImportError:
print("WiFi and API secrets are kept in secrets.py, please add them there!")
raise
# Get WiFi details and LIFX keys, ensure these are setup in settings.toml
# (to obtain a token, visit: https://cloud.lifx.com/settings)
ssid = getenv("CIRCUITPY_WIFI_SSID")
password = getenv("CIRCUITPY_WIFI_PASSWORD")
lifx_token = getenv("lifx_token")

# Set up ESP32-S2 and adafruit_requests session
wifi.radio.connect(ssid=secrets["ssid"], password=secrets["password"])
wifi.radio.connect(ssid=ssid, password=password)
pool = socketpool.SocketPool(wifi.radio)
http_session = adafruit_requests.Session(pool, ssl.create_default_context())

# Add your LIFX Personal Access token to secrets.py
# (to obtain a token, visit: https://cloud.lifx.com/settings)
lifx_token = secrets["lifx_token"]

# Set this to your LIFX light separator label
# https://api.developer.lifx.com/docs/selectors
lifx_light = "label:Lamp"
Expand Down

0 comments on commit 4dcc5f6

Please sign in to comment.