File tree Expand file tree Collapse file tree
PyPortal/pyportal_pet_planter Expand file tree Collapse file tree Original file line number Diff line number Diff line change 22#
33# SPDX-License-Identifier: MIT
44
5+ import os
56import time
67
78import board
5152# the current working directory (where this file is)
5253cwd = ("/" + __file__ ).rsplit ('/' , 1 )[0 ]
5354
54- # Get wifi details and more from a secrets.py file
55- try :
56- from secrets import secrets
57- except ImportError :
58- print ("WiFi secrets are kept in secrets.py, please add them there!" )
59- raise
55+ secrets = {
56+ "ssid" : os .getenv ("CIRCUITPY_WIFI_SSID" ),
57+ "password" : os .getenv ("CIRCUITPY_WIFI_PASSWORD" ),
58+ }
6059
6160# Set up i2c bus
6261i2c_bus = busio .I2C (board .SCL , board .SDA )
191190
192191# Initialize a new MQTT Client object
193192mqtt_client = MQTT .MQTT (broker = "io.adafruit.com" ,
194- username = secrets [ "aio_user" ] ,
195- password = secrets [ "aio_key" ] ,
193+ username = os . getenv ( "AIO_USERNAME" ) ,
194+ password = os . getenv ( "AIO_KEY" ) ,
196195 socket_pool = pool ,
197196 ssl_context = ssl_context )
198197
You can’t perform that action at this time.
0 commit comments