# Set your Adafruit IO Username and Key in secrets.py ADAFRUIT_IO_USER = secrets['aio_username'] ADAFRUIT_IO_KEY = secrets['aio_key'] # Create an instance of the Adafruit IO HTTP client io = IO_HTTP(ADAFRUIT_IO_USER, ADAFRUIT_IO_KEY, wifi) io = IO_HTTP(ADAFRUIT_IO_USER, ADAFRUIT_IO_KEY, wifi) bme680 = adafruit_bme680.Adafruit_BME680_I2C(i2c) # Change this to match the location's pressure (hPa) at sea level bme680.sea_level_pressure = 1013.25 # Set up Adafruit IO Feeds print('Getting Group data from Adafruit IO...') station_group = io.get_group('pyportal-sensor-station') feed_list = station_group['feeds'] altitude_feed = feed_list[0] gas_feed = feed_list[1] humidity_feed = feed_list[2] pressure_feed = feed_list[3] temperature_feed = feed_list[4] gfx = sensor_station_helper.SensorStation_GFX() def send_to_io(): # handle sending sensor data to Adafruit IO io.send_data(temperature_feed['key'], bme680_data[0]) io.send_data(gas_feed['key'], bme680_data[1]) io.send_data(humidity_feed['key'], bme680_data[2])
# instantiate the sensor objects veml = adafruit_veml6075.VEML6075(i2c, integration_time=100) sgp30 = adafruit_sgp30.Adafruit_SGP30(i2c) bme280 = adafruit_bme280.Adafruit_BME280_I2C(i2c) # change this to match the location's pressure (hPa) at sea level bme280.sea_level_pressure = 1013.25 # init. the graphics helper gfx = weatherstation_helper.WeatherStation_GFX() # init. the ADC adc = analogio.AnalogIn(board.D4) # Set up Adafruit IO Feeds print('Getting Group data from Adafruit IO...') station_group = io.get_group('weatherstation') feed_list = station_group['feeds'] altitude_feed = feed_list[0] eco2_feed = feed_list[1] humidity_feed = feed_list[2] pressure_feed = feed_list[3] temperature_feed = feed_list[4] tvoc_feed = feed_list[5] uv_index_feed = feed_list[6] wind_speed_feed = feed_list[7] def adc_to_wind_speed(val): """Returns anemometer wind speed, in m/s. :param int val: ADC value """