Skip to content

Commit a83ab5a

Browse files
authored
Merge pull request #1516 from makermelissa/master
Updated to use temp/hum/pres inside peripherals
2 parents d6982a1 + 02f2127 commit a83ab5a

File tree

1 file changed

+3
-11
lines changed

1 file changed

+3
-11
lines changed

FunHouse_HA_Companion/code.py

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,7 @@
33
#
44
# SPDX-License-Identifier: MIT
55
import time
6-
import board
76
import json
8-
import adafruit_dps310
9-
import adafruit_ahtx0
107
from adafruit_display_shapes.circle import Circle
118
from adafruit_funhouse import FunHouse
129

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

28-
# Connect to the Sensors
29-
i2c = board.I2C()
30-
dps310 = adafruit_dps310.DPS310(i2c)
31-
aht20 = adafruit_ahtx0.AHTx0(i2c)
32-
3325
funhouse = FunHouse(default_bg=0x0F0F00)
3426
funhouse.peripherals.dotstars.fill(INITIAL_LIGHT_COLOR)
3527

@@ -79,15 +71,15 @@
7971
def update_enviro():
8072
global environment
8173

82-
temp = aht20.temperature
74+
temp = funhouse.peripherals.temperature
8375
unit = "C"
8476
if USE_FAHRENHEIT:
8577
temp = temp * (9 / 5) + 32
8678
unit = "F"
8779

8880
environment["temperature"] = temp
89-
environment["pressure"] = dps310.pressure
90-
environment["humidity"] = aht20.relative_humidity
81+
environment["pressure"] = funhouse.peripherals.pressure
82+
environment["humidity"] = funhouse.peripherals.relative_humidity
9183
environment["light"] = funhouse.peripherals.light
9284

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

0 commit comments

Comments
 (0)