Skip to content

Updated to use temp/hum/pres inside peripherals #1516

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

Merged
merged 1 commit into from
Apr 21, 2021
Merged
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
14 changes: 3 additions & 11 deletions FunHouse_HA_Companion/code.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,7 @@
#
# SPDX-License-Identifier: MIT
import time
import board
import json
import adafruit_dps310
import adafruit_ahtx0
from adafruit_display_shapes.circle import Circle
from adafruit_funhouse import FunHouse

Expand All @@ -25,11 +22,6 @@
print("WiFi secrets are kept in secrets.py, please add them there!")
raise

# Connect to the Sensors
i2c = board.I2C()
dps310 = adafruit_dps310.DPS310(i2c)
aht20 = adafruit_ahtx0.AHTx0(i2c)

funhouse = FunHouse(default_bg=0x0F0F00)
funhouse.peripherals.dotstars.fill(INITIAL_LIGHT_COLOR)

Expand Down Expand Up @@ -79,15 +71,15 @@
def update_enviro():
global environment

temp = aht20.temperature
temp = funhouse.peripherals.temperature
unit = "C"
if USE_FAHRENHEIT:
temp = temp * (9 / 5) + 32
unit = "F"

environment["temperature"] = temp
environment["pressure"] = dps310.pressure
environment["humidity"] = aht20.relative_humidity
environment["pressure"] = funhouse.peripherals.pressure
environment["humidity"] = funhouse.peripherals.relative_humidity
environment["light"] = funhouse.peripherals.light

funhouse.set_text("{:.1f}{}".format(environment["temperature"], unit), temp_label)
Expand Down