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

Remove secrets #26

Merged
merged 1 commit into from
Feb 26, 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
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