Secrets Cleanup: P Part 1
This commit is contained in:
parent
ef9f2cc230
commit
f23741077e
26 changed files with 323 additions and 200 deletions
|
|
@ -2,6 +2,7 @@
|
|||
#
|
||||
# SPDX-License-Identifier: MIT
|
||||
|
||||
from os import getenv
|
||||
import time
|
||||
import ssl
|
||||
import wifi
|
||||
|
|
@ -14,6 +15,21 @@ import adafruit_requests
|
|||
from digitalio import DigitalInOut, Direction, Pull
|
||||
from adafruit_debouncer import Debouncer
|
||||
|
||||
# Get WiFi details and Adafruit IO keys, ensure these are setup in settings.toml
|
||||
# (visit io.adafruit.com if you need to create an account, or if you need your Adafruit IO key.)
|
||||
ssid = getenv("CIRCUITPY_WIFI_SSID")
|
||||
password = getenv("CIRCUITPY_WIFI_PASSWORD")
|
||||
aio_username = getenv("ADAFRUIT_AIO_USERNAME")
|
||||
aio_key = getenv("ADAFRUIT_AIO_KEY")
|
||||
|
||||
if None in [ssid, password, aio_username, aio_key]:
|
||||
raise RuntimeError(
|
||||
"WiFi and Adafruit IO settings are kept in settings.toml, "
|
||||
"please add them there. The settings file must contain "
|
||||
"'CIRCUITPY_WIFI_SSID', 'CIRCUITPY_WIFI_PASSWORD', "
|
||||
"'ADAFRUIT_AIO_USERNAME' and 'ADAFRUIT_AIO_KEY' at a minimum."
|
||||
)
|
||||
|
||||
alarm_out = DigitalInOut(board.A1)
|
||||
alarm_out.direction = Direction.OUTPUT
|
||||
alarm_out.value = False
|
||||
|
|
@ -23,37 +39,28 @@ button_in.pull = Pull.UP
|
|||
button = Debouncer(button_in)
|
||||
|
||||
|
||||
# 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
|
||||
|
||||
print("Adafruit Raspberry Pi In Stock Tweet Listener")
|
||||
|
||||
# import your bearer token
|
||||
bear = secrets['bearer_token']
|
||||
bearer_token = getenv('bearer_token')
|
||||
|
||||
# query URL for tweets. looking for hashtag partyparrot sent to a specific username
|
||||
# disabling line-too-long because queries for tweet_query & TIME_URL cannot have line breaks
|
||||
# pylint: disable=line-too-long
|
||||
tweet_query = 'https://api.twitter.com/2/tweets/search/recent?query=In Stock at Adafruit from:rpilocator&tweet.fields=created_at'
|
||||
|
||||
headers = {'Authorization': 'Bearer ' + bear}
|
||||
headers = {'Authorization': 'Bearer ' + bearer_token}
|
||||
|
||||
print("Connecting to %s"%secrets["ssid"])
|
||||
wifi.radio.connect(secrets["ssid"], secrets["password"])
|
||||
print("Connected to %s!"%secrets["ssid"])
|
||||
print("My IP address is", wifi.radio.ipv4_address)
|
||||
print(f"Connecting to {ssid}")
|
||||
wifi.radio.connect(ssid, password)
|
||||
print(f"Connected to {ssid}!")
|
||||
print(f"My IP address is {wifi.radio.ipv4_address}")
|
||||
|
||||
pool = socketpool.SocketPool(wifi.radio)
|
||||
requests = adafruit_requests.Session(pool, ssl.create_default_context())
|
||||
|
||||
# gets and formats time from adafruit.io
|
||||
aio_username = secrets["aio_username"]
|
||||
aio_key = secrets["aio_key"]
|
||||
location = secrets.get("timezone", None)
|
||||
location = getenv("timezone", None)
|
||||
TIME_URL = "https://io.adafruit.com/api/v2/%s/integrations/time/strftime?x-aio-key=%s" % (aio_username, aio_key)
|
||||
TIME_URL += "&fmt=%25Y-%25m-%25dT%25H%3A%25M%3A%25S.%25L%25j%25u%25z%25Z"
|
||||
|
||||
|
|
@ -132,7 +139,7 @@ while True:
|
|||
|
||||
else:
|
||||
# if it's not new, then the wait continues
|
||||
no_tweet_text = ("No stock in last hour :( Last stock: %s" % (timestamp))
|
||||
no_tweet_text = "No stock in last hour :( Last stock: %s" % (timestamp)
|
||||
text_area.text = "\n".join(wrap_text_to_lines(no_tweet_text, 21))
|
||||
print("no new in stock notifications :(")
|
||||
# updates tweet ID
|
||||
|
|
@ -140,6 +147,6 @@ while True:
|
|||
# if the tweet wasn't today
|
||||
else:
|
||||
# if it's not new, then the wait continues
|
||||
no_tweet_text = ("No stock in last hour :( Last stock: %s" % (timestamp))
|
||||
no_tweet_text = "No stock in last hour :( Last stock: %s" % (timestamp)
|
||||
text_area.text = "\n".join(wrap_text_to_lines(no_tweet_text, 21))
|
||||
print("no new in stock notifications :(")
|
||||
|
|
|
|||
|
|
@ -2,17 +2,29 @@
|
|||
#
|
||||
# SPDX-License-Identifier: MIT
|
||||
|
||||
import os
|
||||
from os import getenv
|
||||
import ipaddress
|
||||
import wifi
|
||||
import socketpool
|
||||
|
||||
# Get WiFi details, ensure these are setup in settings.toml
|
||||
ssid = getenv("CIRCUITPY_WIFI_SSID")
|
||||
password = getenv("CIRCUITPY_WIFI_PASSWORD")
|
||||
|
||||
if None in [ssid, password]:
|
||||
raise RuntimeError(
|
||||
"WiFi settings are kept in settings.toml, "
|
||||
"please add them there. The settings file must contain "
|
||||
"'CIRCUITPY_WIFI_SSID', 'CIRCUITPY_WIFI_PASSWORD', "
|
||||
"at a minimum."
|
||||
)
|
||||
|
||||
print()
|
||||
print("Connecting to WiFi")
|
||||
|
||||
# connect to your SSID
|
||||
try:
|
||||
wifi.radio.connect(os.getenv('CIRCUITPY_WIFI_SSID'), os.getenv('CIRCUITPY_WIFI_PASSWORD'))
|
||||
wifi.radio.connect(ssid, password)
|
||||
except TypeError:
|
||||
print("Could not find WiFi info. Check your settings.toml file!")
|
||||
raise
|
||||
|
|
@ -25,7 +37,7 @@ pool = socketpool.SocketPool(wifi.radio)
|
|||
print("My MAC addr:", [hex(i) for i in wifi.radio.mac_address])
|
||||
|
||||
# prints IP address to REPL
|
||||
print("My IP address is", wifi.radio.ipv4_address)
|
||||
print(f"My IP address is {wifi.radio.ipv4_address}")
|
||||
|
||||
# pings Google
|
||||
ipv4 = ipaddress.ip_address("8.8.4.4")
|
||||
|
|
|
|||
|
|
@ -7,17 +7,23 @@
|
|||
# or Matrix Portal
|
||||
# and 64 x 32 RGB LED Matrix
|
||||
|
||||
from os import getenv
|
||||
import time
|
||||
import board
|
||||
import terminalio
|
||||
from adafruit_matrixportal.matrixportal import MatrixPortal
|
||||
|
||||
# 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
|
||||
# Get WiFi details, ensure these are setup in settings.toml
|
||||
ssid = getenv("CIRCUITPY_WIFI_SSID")
|
||||
password = getenv("CIRCUITPY_WIFI_PASSWORD")
|
||||
|
||||
if None in [ssid, password]:
|
||||
raise RuntimeError(
|
||||
"WiFi settings are kept in settings.toml, "
|
||||
"please add them there. The settings file must contain "
|
||||
"'CIRCUITPY_WIFI_SSID', 'CIRCUITPY_WIFI_PASSWORD', "
|
||||
"at a minimum."
|
||||
)
|
||||
|
||||
def aqi_transform(val):
|
||||
aqi = pm_to_aqi(val) # derive Air Quality Index from Particulate Matter 2.5 value
|
||||
|
|
@ -49,7 +55,7 @@ matrixportal = MatrixPortal(
|
|||
status_neopixel=board.NEOPIXEL,
|
||||
debug=True,
|
||||
url=DATA_SOURCE,
|
||||
headers={"X-API-Key": secrets["purple_air_api_key"], # purpleair.com
|
||||
headers={"X-API-Key": getenv("purple_air_api_key"), # purpleair.com
|
||||
"Accept": "application/json"
|
||||
},
|
||||
json_path=(DATA_LOCATION, DATA_LOCATION),
|
||||
|
|
|
|||
|
|
@ -10,7 +10,8 @@ notifications when it needs watering with your PyPortal.
|
|||
|
||||
Author: Brent Rubell for Adafruit Industries, 2019
|
||||
"""
|
||||
import os
|
||||
|
||||
from os import getenv
|
||||
import time
|
||||
import json
|
||||
import board
|
||||
|
|
@ -28,10 +29,17 @@ import aws_gfx_helper
|
|||
# Time between polling the STEMMA, in minutes
|
||||
SENSOR_DELAY = 15
|
||||
|
||||
secrets = {
|
||||
"ssid" : os.getenv("CIRCUITPY_WIFI_SSID"),
|
||||
"password" : os.getenv("CIRCUITPY_WIFI_PASSWORD"),
|
||||
}
|
||||
# Get WiFi details, ensure these are setup in settings.toml
|
||||
ssid = getenv("CIRCUITPY_WIFI_SSID")
|
||||
password = getenv("CIRCUITPY_WIFI_PASSWORD")
|
||||
|
||||
if None in [ssid, password]:
|
||||
raise RuntimeError(
|
||||
"WiFi settings are kept in settings.toml, "
|
||||
"please add them there. The settings file must contain "
|
||||
"'CIRCUITPY_WIFI_SSID', 'CIRCUITPY_WIFI_PASSWORD', "
|
||||
"at a minimum."
|
||||
)
|
||||
|
||||
# Get device certificate
|
||||
try:
|
||||
|
|
@ -65,9 +73,10 @@ esp = adafruit_esp32spi.ESP_SPIcontrol(spi, esp32_cs, esp32_ready, esp32_reset)
|
|||
# Verify nina-fw version >= 1.4.0
|
||||
assert int(bytes(esp.firmware_version).decode("utf-8")[2]) >= 4, "Please update nina-fw to >=1.4.0."
|
||||
|
||||
status_light = neopixel.NeoPixel(board.NEOPIXEL, 1, brightness=0.2)
|
||||
wifi = adafruit_esp32spi_wifimanager.ESPSPI_WiFiManager(
|
||||
esp, secrets, status_light)
|
||||
status_pixel = neopixel.NeoPixel(board.NEOPIXEL, 1, brightness=0.2)
|
||||
wifi = adafruit_esp32spi_wifimanager.WiFiManager(
|
||||
esp, ssid, password, status_pixel=status_pixel
|
||||
)
|
||||
|
||||
# Initialize the graphics helper
|
||||
print("Loading AWS IoT Graphics...")
|
||||
|
|
@ -126,8 +135,8 @@ def message(client, topic, msg):
|
|||
print("Message from {}: {}".format(topic, msg))
|
||||
|
||||
# Set up a new MiniMQTT Client
|
||||
client = MQTT.MQTT(broker = os.getenv("BROKER"),
|
||||
client_id = os.getenv("CLIENT_ID"),
|
||||
client = MQTT.MQTT(broker = getenv("BROKER"),
|
||||
client_id = getenv("CLIENT_ID"),
|
||||
socket_pool=pool,
|
||||
ssl_context=ssl_context)
|
||||
|
||||
|
|
|
|||
|
|
@ -7,19 +7,29 @@ This example will access the adafruit.io API, grab a number like active users
|
|||
and io plus subscribers... and display it on a screen
|
||||
If you can find something that spits out JSON data, we can display it!
|
||||
"""
|
||||
|
||||
from os import getenv
|
||||
import time
|
||||
import board
|
||||
from adafruit_pyportal import PyPortal
|
||||
|
||||
# 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
|
||||
# Get WiFi details and Adafruit IO keys, ensure these are setup in settings.toml
|
||||
# (visit io.adafruit.com if you need to create an account, or if you need your Adafruit IO key.)
|
||||
ssid = getenv("CIRCUITPY_WIFI_SSID")
|
||||
password = getenv("CIRCUITPY_WIFI_PASSWORD")
|
||||
aio_username = getenv("ADAFRUIT_AIO_USERNAME")
|
||||
aio_key = getenv("ADAFRUIT_AIO_KEY")
|
||||
|
||||
if None in [ssid, password, aio_username, aio_key]:
|
||||
raise RuntimeError(
|
||||
"WiFi and Adafruit IO settings are kept in settings.toml, "
|
||||
"please add them there. The settings file must contain "
|
||||
"'CIRCUITPY_WIFI_SSID', 'CIRCUITPY_WIFI_PASSWORD', "
|
||||
"'ADAFRUIT_AIO_USERNAME' and 'ADAFRUIT_AIO_KEY' at a minimum."
|
||||
)
|
||||
|
||||
# Set up where we'll be fetching data from
|
||||
DATA_SOURCE = "https://io.adafruit.com/api/v2/stats?x-aio-key="+secrets['aio_key']
|
||||
DATA_SOURCE = f"https://io.adafruit.com/api/v2/stats?x-aio-key={aio_key}"
|
||||
DATA_LOCATION1 = ["io_plus", "io_plus_subscriptions"]
|
||||
DATA_LOCATION2 = ["users", "users_active_30_days"]
|
||||
|
||||
|
|
|
|||
|
|
@ -12,6 +12,8 @@ Dependencies:
|
|||
* CircuitPython_AdafruitIO
|
||||
https://github.com/adafruit/Adafruit_CircuitPython_AdafruitIO
|
||||
"""
|
||||
|
||||
from os import getenv
|
||||
import time
|
||||
import board
|
||||
import busio
|
||||
|
|
@ -33,12 +35,20 @@ import adafruit_adt7410
|
|||
# Timeout between sending data to Adafruit IO, in seconds
|
||||
IO_DELAY = 30
|
||||
|
||||
# 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
|
||||
# Get WiFi details and Adafruit IO keys, ensure these are setup in settings.toml
|
||||
# (visit io.adafruit.com if you need to create an account, or if you need your Adafruit IO key.)
|
||||
ssid = getenv("CIRCUITPY_WIFI_SSID")
|
||||
password = getenv("CIRCUITPY_WIFI_PASSWORD")
|
||||
aio_username = getenv("ADAFRUIT_AIO_USERNAME")
|
||||
aio_key = getenv("ADAFRUIT_AIO_KEY")
|
||||
|
||||
if None in [ssid, password, aio_username, aio_key]:
|
||||
raise RuntimeError(
|
||||
"WiFi and Adafruit IO settings are kept in settings.toml, "
|
||||
"please add them there. The settings file must contain "
|
||||
"'CIRCUITPY_WIFI_SSID', 'CIRCUITPY_WIFI_PASSWORD', "
|
||||
"'ADAFRUIT_AIO_USERNAME' and 'ADAFRUIT_AIO_KEY' at a minimum."
|
||||
)
|
||||
|
||||
# PyPortal ESP32 Setup
|
||||
esp32_cs = DigitalInOut(board.ESP_CS)
|
||||
|
|
@ -46,17 +56,11 @@ esp32_ready = DigitalInOut(board.ESP_BUSY)
|
|||
esp32_reset = DigitalInOut(board.ESP_RESET)
|
||||
spi = busio.SPI(board.SCK, board.MOSI, board.MISO)
|
||||
esp = adafruit_esp32spi.ESP_SPIcontrol(spi, esp32_cs, esp32_ready, esp32_reset)
|
||||
status_light = neopixel.NeoPixel(board.NEOPIXEL, 1, brightness=0.2)
|
||||
wifi = adafruit_esp32spi_wifimanager.ESPSPI_WiFiManager(esp, secrets, status_light)
|
||||
|
||||
# Set your Adafruit IO Username and Key in secrets.py
|
||||
# (visit io.adafruit.com if you need to create an account,
|
||||
# or if you need your Adafruit IO key.)
|
||||
ADAFRUIT_IO_USER = secrets['aio_username']
|
||||
ADAFRUIT_IO_KEY = secrets['aio_key']
|
||||
status_pixel = neopixel.NeoPixel(board.NEOPIXEL, 1, brightness=0.2)
|
||||
wifi = adafruit_esp32spi_wifimanager.WiFiManager(esp, ssid, password, status_pixel=status_pixel)
|
||||
|
||||
# Create an instance of the Adafruit IO HTTP client
|
||||
io = IO_HTTP(ADAFRUIT_IO_USER, ADAFRUIT_IO_KEY, wifi)
|
||||
io = IO_HTTP(aio_username, aio_key, wifi)
|
||||
|
||||
try:
|
||||
# Get the 'temperature' feed from Adafruit IO
|
||||
|
|
|
|||
|
|
@ -20,9 +20,9 @@ All text above must be included in any redistribution.
|
|||
#pylint:disable=no-self-use,too-many-branches,too-many-statements
|
||||
#pylint:disable=useless-super-delegation, too-many-locals
|
||||
|
||||
from os import getenv
|
||||
import time
|
||||
import json
|
||||
from secrets import secrets
|
||||
import board
|
||||
from adafruit_pyportal import PyPortal
|
||||
from adafruit_bitmap_font import bitmap_font
|
||||
|
|
@ -32,9 +32,21 @@ import analogio
|
|||
import displayio
|
||||
import adafruit_logging as logging
|
||||
|
||||
# Get WiFi details, ensure these are setup in settings.toml
|
||||
ssid = getenv("CIRCUITPY_WIFI_SSID")
|
||||
password = getenv("CIRCUITPY_WIFI_PASSWORD")
|
||||
|
||||
if None in [ssid, password]:
|
||||
raise RuntimeError(
|
||||
"WiFi settings are kept in settings.toml, "
|
||||
"please add them there. The settings file must contain "
|
||||
"'CIRCUITPY_WIFI_SSID', 'CIRCUITPY_WIFI_PASSWORD', "
|
||||
"at a minimum."
|
||||
)
|
||||
|
||||
# Set up where we'll be fetching data from
|
||||
DATA_SOURCE = 'http://api.openweathermap.org/data/2.5/weather?id='+secrets['city_id']
|
||||
DATA_SOURCE += '&appid='+secrets['openweather_token']
|
||||
DATA_SOURCE = 'http://api.openweathermap.org/data/2.5/weather?id='+getenv('city_id')
|
||||
DATA_SOURCE += '&appid='+getenv('openweather_token')
|
||||
# You'll need to get a token from openweather.org, looks like 'b6907d289e10d714a6e88b30761fae22'
|
||||
DATA_LOCATION = []
|
||||
|
||||
|
|
@ -73,7 +85,7 @@ mugsy_background = 'mugsy_background.bmp'
|
|||
|
||||
icon_file = None
|
||||
icon_sprite = None
|
||||
celcius = secrets['celcius']
|
||||
celcius = getenv('celcius')
|
||||
|
||||
# display/data refresh timers
|
||||
|
||||
|
|
@ -243,7 +255,7 @@ class Time_State(State):
|
|||
if (not self.refresh_time) or ((now - self.refresh_time) > 3600):
|
||||
logger.debug('Fetching time')
|
||||
try:
|
||||
pyportal.get_local_time(location=secrets['timezone'])
|
||||
pyportal.get_local_time(location=getenv('timezone'))
|
||||
self.refresh_time = now
|
||||
except RuntimeError as e:
|
||||
self.refresh_time = now - 3000 # delay 10 minutes before retrying
|
||||
|
|
|
|||
|
|
@ -12,6 +12,8 @@ your PyPortal
|
|||
Authors: Brent Rubell for Adafruit Industries, 2019
|
||||
: Jim Bennett for Microsoft, 2020
|
||||
"""
|
||||
|
||||
from os import getenv
|
||||
import time
|
||||
import json
|
||||
import board
|
||||
|
|
@ -30,12 +32,17 @@ import azure_gfx_helper
|
|||
# init. graphics helper
|
||||
gfx = azure_gfx_helper.Azure_GFX(is_celsius=True)
|
||||
|
||||
# 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
|
||||
# Get WiFi details, ensure these are setup in settings.toml
|
||||
ssid = getenv("CIRCUITPY_WIFI_SSID")
|
||||
password = getenv("CIRCUITPY_WIFI_PASSWORD")
|
||||
|
||||
if None in [ssid, password]:
|
||||
raise RuntimeError(
|
||||
"WiFi settings are kept in settings.toml, "
|
||||
"please add them there. The settings file must contain "
|
||||
"'CIRCUITPY_WIFI_SSID', 'CIRCUITPY_WIFI_PASSWORD', "
|
||||
"at a minimum."
|
||||
)
|
||||
|
||||
# PyPortal ESP32 Setup
|
||||
esp32_cs = DigitalInOut(board.ESP_CS)
|
||||
|
|
@ -45,8 +52,8 @@ spi = busio.SPI(board.SCK, board.MOSI, board.MISO)
|
|||
esp = adafruit_esp32spi.ESP_SPIcontrol(spi, esp32_cs, esp32_ready, esp32_reset)
|
||||
|
||||
# Set up the WiFi manager with a status light to show the WiFi connection status
|
||||
status_light = neopixel.NeoPixel(board.NEOPIXEL, 1, brightness=0.2)
|
||||
wifi = adafruit_esp32spi_wifimanager.ESPSPI_WiFiManager(esp, secrets, status_light)
|
||||
status_pixel = neopixel.NeoPixel(board.NEOPIXEL, 1, brightness=0.2)
|
||||
wifi = adafruit_esp32spi_wifimanager.WiFiManager(esp, ssid, password, status_pixel=status_pixel)
|
||||
print("WiFi connecting...")
|
||||
wifi.connect()
|
||||
print("WiFi connected!")
|
||||
|
|
@ -68,7 +75,7 @@ ss = Seesaw(i2c_bus, addr=0x36)
|
|||
|
||||
# Create an instance of the Azure IoT Central device
|
||||
device = IoTCentralDevice(
|
||||
socket, esp, secrets["id_scope"], secrets["device_id"], secrets["key"]
|
||||
socket, esp, getenv("id_scope"), getenv("device_id"), getenv("key")
|
||||
)
|
||||
|
||||
# Connect to Azure IoT Central
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
#
|
||||
# SPDX-License-Identifier: MIT
|
||||
|
||||
from os import getenv
|
||||
import time
|
||||
import random
|
||||
import board
|
||||
|
|
@ -11,6 +12,18 @@ from adafruit_display_shapes.circle import Circle
|
|||
WIDTH = board.DISPLAY.width
|
||||
HEIGHT = board.DISPLAY.height
|
||||
|
||||
# Get WiFi details, ensure these are setup in settings.toml
|
||||
ssid = getenv("CIRCUITPY_WIFI_SSID")
|
||||
password = getenv("CIRCUITPY_WIFI_PASSWORD")
|
||||
|
||||
if None in [ssid, password]:
|
||||
raise RuntimeError(
|
||||
"WiFi settings are kept in settings.toml, "
|
||||
"please add them there. The settings file must contain "
|
||||
"'CIRCUITPY_WIFI_SSID', 'CIRCUITPY_WIFI_PASSWORD', "
|
||||
"at a minimum."
|
||||
)
|
||||
|
||||
#pylint: disable=line-too-long
|
||||
|
||||
# these lines show the entire collection
|
||||
|
|
|
|||
|
|
@ -1,13 +0,0 @@
|
|||
# SPDX-FileCopyrightText: 2019 Kattni Rembor for Adafruit Industries
|
||||
#
|
||||
# SPDX-License-Identifier: MIT
|
||||
|
||||
# This file is where you keep secret settings, passwords, and tokens!
|
||||
# If you put them in the code you risk committing that info or sharing it
|
||||
|
||||
secrets = {
|
||||
'ssid' : 'CHANGE ME',
|
||||
'password' : 'CHANGE ME',
|
||||
'aio_username' : 'CHANGE ME',
|
||||
'aio_key' : 'CHANGE ME',
|
||||
}
|
||||
9
PyPortal/PyPortal_CMA_Art_Frame/settings.toml
Normal file
9
PyPortal/PyPortal_CMA_Art_Frame/settings.toml
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
# SPDX-FileCopyrightText: 2019 Kattni Rembor for Adafruit Industries
|
||||
#
|
||||
# SPDX-License-Identifier: MIT
|
||||
|
||||
# This file is where you keep private settings, passwords, and tokens!
|
||||
# If you put them in the code you risk committing that info or sharing it
|
||||
|
||||
CIRCUITPY_WIFI_SSID="your-wifi-ssid"
|
||||
CIRCUITPY_WIFI_PASSWORD="your-wifi-password"
|
||||
|
|
@ -1,7 +0,0 @@
|
|||
PyPortal_Electioncal_US/electioncal_graphics.py 73: Line too long (120/100) (line-too-long)
|
||||
PyPortal_Electioncal_US/electioncal_graphics.py 75: Line too long (108/100) (line-too-long)
|
||||
PyPortal_Electioncal_US/electioncal_graphics.py 86: Line too long (141/100) (line-too-long)
|
||||
PyPortal_Electioncal_US/electioncal_graphics.py 107: Unused variable 'time_str' (unused-variable)
|
||||
PyPortal_Electioncal_US/electioncal_graphics.py 111: Method could be a function (no-self-use)
|
||||
PyPortal_Electioncal_US/electioncal_graphics.py 72: Attribute 'electioncal' defined outside __init__ (attribute-defined-outside-init)
|
||||
PyPortal_Electioncal_US/electioncal.py 11: Unused secrets imported from secrets (unused-import)
|
||||
|
|
@ -2,6 +2,7 @@
|
|||
#
|
||||
# SPDX-License-Identifier: MIT
|
||||
|
||||
from os import getenv
|
||||
import sys
|
||||
import time
|
||||
import board
|
||||
|
|
@ -10,12 +11,17 @@ cwd = ("/"+__file__).rsplit('/', 1)[0] # the current working directory (where th
|
|||
sys.path.append(cwd)
|
||||
import electioncal_graphics # pylint: disable=wrong-import-position
|
||||
|
||||
# Get wifi details and more from a secrets.py file
|
||||
try:
|
||||
from secrets import secrets # pylint: disable=unused-import
|
||||
except ImportError:
|
||||
print("WiFi secrets are kept in secrets.py, please add them there!")
|
||||
raise
|
||||
# Get WiFi details, ensure these are setup in settings.toml
|
||||
ssid = getenv("CIRCUITPY_WIFI_SSID")
|
||||
password = getenv("CIRCUITPY_WIFI_PASSWORD")
|
||||
|
||||
if None in [ssid, password]:
|
||||
raise RuntimeError(
|
||||
"WiFi settings are kept in settings.toml, "
|
||||
"please add them there. The settings file must contain "
|
||||
"'CIRCUITPY_WIFI_SSID', 'CIRCUITPY_WIFI_PASSWORD', "
|
||||
"at a minimum."
|
||||
)
|
||||
|
||||
# Change this to your state and county, replacing spaces for underscores and in lowercase
|
||||
STATE="new_york"
|
||||
|
|
|
|||
|
|
@ -112,7 +112,8 @@ class Electioncal_Graphics(displayio.Group):
|
|||
date_str = date_format_str % (year, month, day)
|
||||
self.date_text.text = "Today is: " + date_str
|
||||
|
||||
def paragrapher(self, text, cut): # pylint: disable=no-self-use
|
||||
@staticmethod
|
||||
def paragrapher(text, cut):
|
||||
""" Cuts a long line into two, having spaces in mind.
|
||||
Note we return line2 first as it looks better to clear the line2
|
||||
before printing a line1 with empty line2
|
||||
|
|
|
|||
|
|
@ -7,25 +7,30 @@ PyPortal Adafruit IO Feed Display
|
|||
|
||||
Displays an Adafruit IO Feed on a PyPortal.
|
||||
"""
|
||||
|
||||
from os import getenv
|
||||
import time
|
||||
import board
|
||||
from adafruit_pyportal import PyPortal
|
||||
|
||||
# Get Adafruit IO details and more from a secrets.py file
|
||||
try:
|
||||
from secrets import secrets
|
||||
except ImportError:
|
||||
print("Adafruit IO secrets are kept in secrets.py, please add them there!")
|
||||
raise
|
||||
# (visit io.adafruit.com if you need to create an account, or if you need your Adafruit IO key.)
|
||||
ssid = getenv("CIRCUITPY_WIFI_SSID")
|
||||
password = getenv("CIRCUITPY_WIFI_PASSWORD")
|
||||
aio_username = getenv("ADAFRUIT_AIO_USERNAME")
|
||||
aio_key = getenv("ADAFRUIT_AIO_KEY")
|
||||
|
||||
if None in [ssid, password, aio_username, aio_key]:
|
||||
raise RuntimeError(
|
||||
"WiFi and Adafruit IO settings are kept in settings.toml, "
|
||||
"please add them there. The settings file must contain "
|
||||
"'CIRCUITPY_WIFI_SSID', 'CIRCUITPY_WIFI_PASSWORD', "
|
||||
"'ADAFRUIT_AIO_USERNAME' and 'ADAFRUIT_AIO_KEY' at a minimum."
|
||||
)
|
||||
|
||||
# Adafruit IO Account
|
||||
IO_USER = secrets['aio_username']
|
||||
IO_KEY = secrets['aio_key']
|
||||
# Adafruit IO Feed
|
||||
IO_FEED = 'zapemail'
|
||||
io_feed = 'zapemail'
|
||||
|
||||
DATA_SOURCE = "https://io.adafruit.com/api/v2/{0}/feeds/{1}?X-AIO-Key={2}".format(IO_USER,
|
||||
IO_FEED, IO_KEY)
|
||||
DATA_SOURCE = f"https://io.adafruit.com/api/v2/{aio_username}/feeds/{io_feed}?X-AIO-Key={aio_key}"
|
||||
FEED_VALUE_LOCATION = ['last_value']
|
||||
|
||||
cwd = ("/"+__file__).rsplit('/', 1)[0]
|
||||
|
|
|
|||
|
|
@ -10,6 +10,8 @@ Cloud IoT Core with your PyPortal.
|
|||
|
||||
Author: Brent Rubell for Adafruit Industries, 2019
|
||||
"""
|
||||
|
||||
from os import getenv
|
||||
import time
|
||||
import json
|
||||
import board
|
||||
|
|
@ -23,25 +25,31 @@ import adafruit_minimqtt.adafruit_minimqtt as MQTT
|
|||
from adafruit_seesaw.seesaw import Seesaw
|
||||
import digitalio
|
||||
|
||||
# Get WiFi details, ensure these are setup in settings.toml
|
||||
ssid = getenv("CIRCUITPY_WIFI_SSID")
|
||||
password = getenv("CIRCUITPY_WIFI_PASSWORD")
|
||||
|
||||
if None in [ssid, password]:
|
||||
raise RuntimeError(
|
||||
"WiFi settings are kept in settings.toml, "
|
||||
"please add them there. The settings file must contain "
|
||||
"'CIRCUITPY_WIFI_SSID', 'CIRCUITPY_WIFI_PASSWORD', "
|
||||
"at a minimum."
|
||||
)
|
||||
|
||||
# Delay before reading the sensors, in minutes
|
||||
SENSOR_DELAY = 10
|
||||
|
||||
# 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
|
||||
|
||||
# PyPortal ESP32 Setup
|
||||
esp32_cs = digitalio.DigitalInOut(board.ESP_CS)
|
||||
esp32_ready = digitalio.DigitalInOut(board.ESP_BUSY)
|
||||
esp32_reset = digitalio.DigitalInOut(board.ESP_RESET)
|
||||
spi = busio.SPI(board.SCK, board.MOSI, board.MISO)
|
||||
esp = adafruit_esp32spi.ESP_SPIcontrol(spi, esp32_cs, esp32_ready, esp32_reset)
|
||||
status_light = neopixel.NeoPixel(board.NEOPIXEL, 1, brightness=0.2)
|
||||
wifi = adafruit_esp32spi_wifimanager.ESPSPI_WiFiManager(
|
||||
esp, secrets, status_light)
|
||||
status_pixel = neopixel.NeoPixel(board.NEOPIXEL, 1, brightness=0.2)
|
||||
wifi = adafruit_esp32spi_wifimanager.WiFiManager(
|
||||
esp, ssid, password, status_pixel=status_pixel
|
||||
)
|
||||
|
||||
# Connect to WiFi
|
||||
print("Connecting to WiFi...")
|
||||
|
|
@ -137,7 +145,14 @@ def handle_pump(command):
|
|||
|
||||
|
||||
# Initialize Google Cloud IoT Core interface
|
||||
google_iot = Cloud_Core(esp, secrets)
|
||||
settings = {
|
||||
"cloud_region": getenv("cloud_region"),
|
||||
"device_id": getenv("device_id"),
|
||||
"private_key": getenv("private_key"),
|
||||
"project_id": getenv("project_id"),
|
||||
"registry_id": getenv("registry_id"),
|
||||
}
|
||||
google_iot = Cloud_Core(esp, settings)
|
||||
|
||||
# JSON-Web-Token (JWT) Generation
|
||||
print("Generating JWT...")
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@ class Google_GFX(displayio.Group):
|
|||
temp_group.append(temp_label)
|
||||
|
||||
self.temp_data_label = Label(font, text="75 F")
|
||||
self.temp_data_label.x = (self.display.width//3)
|
||||
self.temp_data_label.x = self.display.width//3
|
||||
self.temp_data_label.y = 55
|
||||
temp_group.append(self.temp_data_label)
|
||||
self._text_group.append(temp_group)
|
||||
|
|
@ -72,7 +72,7 @@ class Google_GFX(displayio.Group):
|
|||
water_group.append(self.water_level)
|
||||
|
||||
self.water_lvl_label = Label(font, text="350")
|
||||
self.water_lvl_label.x = (self.display.width//3)
|
||||
self.water_lvl_label.x = self.display.width//3
|
||||
self.water_lvl_label.y = 75
|
||||
temp_group.append(self.water_lvl_label)
|
||||
self._text_group.append(water_group)
|
||||
|
|
|
|||
|
|
@ -7,23 +7,31 @@ This example will access the github API, grab a number like
|
|||
the number of stars for a repository... and display it on a screen!
|
||||
if you can find something that spits out JSON data, we can display it
|
||||
"""
|
||||
|
||||
from os import getenv
|
||||
import time
|
||||
import board
|
||||
from adafruit_pyportal import PyPortal
|
||||
|
||||
# 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
|
||||
# Get WiFi details, ensure these are setup in settings.toml
|
||||
ssid = getenv("CIRCUITPY_WIFI_SSID")
|
||||
password = getenv("CIRCUITPY_WIFI_PASSWORD")
|
||||
|
||||
if None in [ssid, password]:
|
||||
raise RuntimeError(
|
||||
"WiFi settings are kept in settings.toml, "
|
||||
"please add them there. The settings file must contain "
|
||||
"'CIRCUITPY_WIFI_SSID', 'CIRCUITPY_WIFI_PASSWORD', "
|
||||
"at a minimum."
|
||||
)
|
||||
|
||||
# Set up where we'll be fetching data from
|
||||
DATA_SOURCE = "https://api.github.com/repos/adafruit/circuitpython"
|
||||
CAPTION = "www.github.com/adafruit/circuitpython"
|
||||
# If we have an access token, we can query more often
|
||||
if 'github_token' in secrets:
|
||||
DATA_SOURCE += "?access_token="+secrets['github_token']
|
||||
github_token = getenv("github_token")
|
||||
if github_token:
|
||||
DATA_SOURCE += f"?access_token={github_token}"
|
||||
|
||||
# The data we want to display
|
||||
DATA_LOCATION = ["stargazers_count"]
|
||||
|
|
|
|||
|
|
@ -1,12 +0,0 @@
|
|||
# SPDX-FileCopyrightText: 2020 Liz Clark for Adafruit Industries
|
||||
#
|
||||
# SPDX-License-Identifier: MIT
|
||||
|
||||
secrets = {
|
||||
'ssid' : 'your-ssid-here',
|
||||
'password' : 'your-password-here',
|
||||
'openweather_token' : 'your-openweather-token-here',
|
||||
'aio_username' : "your-aio-username-here",
|
||||
'aio_key' : 'your-aio-key-here',
|
||||
'location' : 'New York, US'
|
||||
}
|
||||
|
|
@ -8,20 +8,27 @@ and display it on a screen
|
|||
If you can find something that spits out JSON data, we can display it!
|
||||
Note that you need a hackaday API key to access the API!
|
||||
"""
|
||||
|
||||
from os import getenv
|
||||
import time
|
||||
import board
|
||||
from adafruit_pyportal import PyPortal
|
||||
|
||||
# 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
|
||||
# Get WiFi details, ensure these are setup in settings.toml
|
||||
ssid = getenv("CIRCUITPY_WIFI_SSID")
|
||||
password = getenv("CIRCUITPY_WIFI_PASSWORD")
|
||||
|
||||
if None in [ssid, password]:
|
||||
raise RuntimeError(
|
||||
"WiFi settings are kept in settings.toml, "
|
||||
"please add them there. The settings file must contain "
|
||||
"'CIRCUITPY_WIFI_SSID', 'CIRCUITPY_WIFI_PASSWORD', "
|
||||
"at a minimum."
|
||||
)
|
||||
|
||||
# Some data sources and JSON locations to try out
|
||||
CAPTION="hackaday.io/project/163309-circuitpython-hackaday"
|
||||
DATA_SOURCE = "https://api.hackaday.io/v1/projects/163309?api_key="+secrets['hackaday_token']
|
||||
DATA_SOURCE = "https://api.hackaday.io/v1/projects/163309?api_key="+getenv('hackaday_token')
|
||||
DATA_LOCATION = ["skulls"]
|
||||
|
||||
# the current working directory (where this file is)
|
||||
|
|
|
|||
|
|
@ -2,23 +2,29 @@
|
|||
#
|
||||
# SPDX-License-Identifier: MIT
|
||||
|
||||
from os import getenv
|
||||
import time
|
||||
import board
|
||||
from adafruit_pyportal import PyPortal
|
||||
|
||||
# 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
|
||||
# Get WiFi details, ensure these are setup in settings.toml
|
||||
ssid = getenv("CIRCUITPY_WIFI_SSID")
|
||||
password = getenv("CIRCUITPY_WIFI_PASSWORD")
|
||||
|
||||
if None in [ssid, password]:
|
||||
raise RuntimeError(
|
||||
"WiFi settings are kept in settings.toml, "
|
||||
"please add them there. The settings file must contain "
|
||||
"'CIRCUITPY_WIFI_SSID', 'CIRCUITPY_WIFI_PASSWORD', "
|
||||
"at a minimum."
|
||||
)
|
||||
|
||||
PROJECT_NAME = "3c92f0"
|
||||
|
||||
# Set up where we'll be fetching data from
|
||||
DATA_SOURCE = "https://api.hackster.io/v2/projects/"+PROJECT_NAME+"?"
|
||||
DATA_SOURCE += "client_id="+secrets['hackster_clientid']
|
||||
DATA_SOURCE += "&client_secret="+secrets['hackster_secret']
|
||||
DATA_SOURCE += "client_id="+getenv('hackster_clientid')
|
||||
DATA_SOURCE += "&client_secret="+getenv('hackster_secret')
|
||||
VIEWS_LOCATION = ['stats', 'views']
|
||||
LIKES_LOCATION = ['stats', 'respects']
|
||||
CAPTION = "http://www.hackster.com/project/"+PROJECT_NAME
|
||||
|
|
|
|||
|
|
@ -2,22 +2,28 @@
|
|||
#
|
||||
# SPDX-License-Identifier: MIT
|
||||
|
||||
from os import getenv
|
||||
import time
|
||||
import random
|
||||
import board
|
||||
import adafruit_pyportal
|
||||
|
||||
# Get wifi details and more from a settings.py file
|
||||
try:
|
||||
from secrets import secrets
|
||||
except ImportError:
|
||||
print("WiFi secrets are kept in secrets.py, please add them there!")
|
||||
raise
|
||||
# Get WiFi details, ensure these are setup in settings.toml
|
||||
ssid = getenv("CIRCUITPY_WIFI_SSID")
|
||||
password = getenv("CIRCUITPY_WIFI_PASSWORD")
|
||||
|
||||
if None in [ssid, password]:
|
||||
raise RuntimeError(
|
||||
"WiFi settings are kept in settings.toml, "
|
||||
"please add them there. The settings file must contain "
|
||||
"'CIRCUITPY_WIFI_SSID', 'CIRCUITPY_WIFI_PASSWORD', "
|
||||
"at a minimum."
|
||||
)
|
||||
|
||||
# Set up where we'll be fetching data from
|
||||
DATA_SOURCE = "https://api.hackster.io/v2/projects?"
|
||||
DATA_SOURCE += "client_id="+secrets['hackster_clientid']
|
||||
DATA_SOURCE += "&client_secret="+secrets['hackster_secret']
|
||||
DATA_SOURCE += "client_id="+getenv('hackster_clientid')
|
||||
DATA_SOURCE += "&client_secret="+getenv('hackster_secret')
|
||||
IMAGE_LOCATION = ['records', 0, "cover_image_url"]
|
||||
TITLE_LOCATION = ['records',0, "name"]
|
||||
HID_LOCATION = ['records', 0, "hid"]
|
||||
|
|
|
|||
|
|
@ -16,8 +16,7 @@ Licensed under the MIT license.
|
|||
All text above must be included in any redistribution.
|
||||
"""
|
||||
|
||||
#pylint:disable=invalid-name
|
||||
import os
|
||||
from os import getenv
|
||||
import time
|
||||
import random
|
||||
import board
|
||||
|
|
@ -25,6 +24,19 @@ from adafruit_pyportal import PyPortal
|
|||
from adafruit_bitmap_font import bitmap_font
|
||||
from adafruit_display_text.label import Label
|
||||
|
||||
# Get WiFi details, ensure these are setup in settings.toml
|
||||
ssid = getenv("CIRCUITPY_WIFI_SSID")
|
||||
password = getenv("CIRCUITPY_WIFI_PASSWORD")
|
||||
|
||||
if None in [ssid, password]:
|
||||
raise RuntimeError(
|
||||
"WiFi settings are kept in settings.toml, "
|
||||
"please add them there. The settings file must contain "
|
||||
"'CIRCUITPY_WIFI_SSID', 'CIRCUITPY_WIFI_PASSWORD', "
|
||||
"at a minimum."
|
||||
)
|
||||
|
||||
|
||||
# The time of the thing!
|
||||
EVENT_YEAR = 2019
|
||||
EVENT_MONTH = 10
|
||||
|
|
@ -83,7 +95,7 @@ while True:
|
|||
if (not refresh_time) or (time.monotonic() - refresh_time) > 3600:
|
||||
try:
|
||||
print("Getting time from internet!")
|
||||
pyportal.get_local_time(location=os.getenv("TIMEZONE"))
|
||||
pyportal.get_local_time(location=getenv("timezone"))
|
||||
refresh_time = time.monotonic()
|
||||
except RuntimeError as e:
|
||||
print("Some error occured, retrying! -", e)
|
||||
|
|
|
|||
|
|
@ -1,14 +0,0 @@
|
|||
# SPDX-FileCopyrightText: 2019 Kattni Rembor for Adafruit Industries
|
||||
#
|
||||
# SPDX-License-Identifier: MIT
|
||||
|
||||
# This file is where you keep secret settings, passwords, and tokens!
|
||||
# If you put them in the code you risk committing that info or sharing it
|
||||
|
||||
secrets = {
|
||||
'ssid' : 'CHANGE ME',
|
||||
'password' : 'CHANGE ME',
|
||||
'timezone' : 'CHANGE ME',
|
||||
'aio_username' : 'CHANGE ME',
|
||||
'aio_key' : 'CHANGE ME',
|
||||
}
|
||||
10
PyPortal/PyPortal_Halloween_Countdown/settings.toml
Normal file
10
PyPortal/PyPortal_Halloween_Countdown/settings.toml
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
# SPDX-FileCopyrightText: 2019 Kattni Rembor for Adafruit Industries
|
||||
#
|
||||
# SPDX-License-Identifier: MIT
|
||||
|
||||
# This file is where you keep private settings, passwords, and tokens!
|
||||
# If you put them in the code you risk committing that info or sharing it
|
||||
|
||||
CIRCUITPY_WIFI_SSID="your-wifi-ssid"
|
||||
CIRCUITPY_WIFI_PASSWORD="your-wifi-password"
|
||||
timezone="America/New_York" # http://worldtimeapi.org/timezones
|
||||
|
|
@ -8,6 +8,8 @@ an internet of things smart-scale for Adafruit IO
|
|||
|
||||
Brent Rubell for Adafruit Industries, 2019
|
||||
"""
|
||||
|
||||
from os import getenv
|
||||
import time
|
||||
import board
|
||||
import adafruit_dymoscale
|
||||
|
|
@ -22,12 +24,20 @@ from adafruit_esp32spi import adafruit_esp32spi, adafruit_esp32spi_wifimanager
|
|||
import neopixel
|
||||
from adafruit_io.adafruit_io import IO_HTTP
|
||||
|
||||
# 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
|
||||
# Get WiFi details and Adafruit IO keys, ensure these are setup in settings.toml
|
||||
# (visit io.adafruit.com if you need to create an account, or if you need your Adafruit IO key.)
|
||||
ssid = getenv("CIRCUITPY_WIFI_SSID")
|
||||
password = getenv("CIRCUITPY_WIFI_PASSWORD")
|
||||
aio_username = getenv("ADAFRUIT_AIO_USERNAME")
|
||||
aio_key = getenv("ADAFRUIT_AIO_KEY")
|
||||
|
||||
if None in [ssid, password, aio_username, aio_key]:
|
||||
raise RuntimeError(
|
||||
"WiFi and Adafruit IO settings are kept in settings.toml, "
|
||||
"please add them there. The settings file must contain "
|
||||
"'CIRCUITPY_WIFI_SSID', 'CIRCUITPY_WIFI_PASSWORD', "
|
||||
"'ADAFRUIT_AIO_USERNAME' and 'ADAFRUIT_AIO_KEY' at a minimum."
|
||||
)
|
||||
|
||||
# the current working directory (where this file is)
|
||||
cwd = ("/"+__file__).rsplit('/', 1)[0]
|
||||
|
|
@ -69,14 +79,8 @@ esp32_ready = digitalio.DigitalInOut(board.ESP_BUSY)
|
|||
esp32_reset = digitalio.DigitalInOut(board.ESP_RESET)
|
||||
spi = busio.SPI(board.SCK, board.MOSI, board.MISO)
|
||||
esp = adafruit_esp32spi.ESP_SPIcontrol(spi, esp32_cs, esp32_ready, esp32_reset)
|
||||
status_light = neopixel.NeoPixel(board.NEOPIXEL, 1, brightness=0.2)
|
||||
wifi = adafruit_esp32spi_wifimanager.ESPSPI_WiFiManager(esp, secrets, status_light)
|
||||
|
||||
# Set your Adafruit IO Username and Key in secrets.py
|
||||
# (visit io.adafruit.com if you need to create an account,
|
||||
# or if you need your Adafruit IO key.)
|
||||
aio_username = secrets['aio_username']
|
||||
aio_key = secrets['aio_key']
|
||||
status_pixel = neopixel.NeoPixel(board.NEOPIXEL, 1, brightness=0.2)
|
||||
wifi = adafruit_esp32spi_wifimanager.WiFiManager(esp, ssid, password, status_pixel=status_pixel)
|
||||
|
||||
# Create an instance of the IO_HTTP client
|
||||
io = IO_HTTP(aio_username, aio_key, wifi)
|
||||
|
|
|
|||
Loading…
Reference in a new issue