Update to use sensor endpoints

This commit is contained in:
William Moore 2022-05-22 20:22:30 -05:00
parent 909a440dc4
commit b10194e6ed
3 changed files with 8 additions and 15 deletions

View File

@ -1,7 +1,5 @@
XMPP_RECEIVER=
XMPP_SENDER=
XMPP_SENDER_PASSWORD=
INPUT_PIN=
NOTIF_URL=
SENSOR_URL=
SET_POINT=82.22
MESSAGE="The water is too damn hot! :tea:"

View File

@ -1,6 +1,3 @@
Adafruit_Blinka==6.16.0
adafruit_circuitpython_max31865==2.2.10
Flask==1.1.2
python-dotenv==0.20.0
requests==2.25.1
xmpppy==0.7.0

View File

@ -14,9 +14,6 @@
# You should have received a copy of the GNU General Public License along
# with this program. If not, see <https://www.gnu.org/licenses/>.
import board
import digitalio
import adafruit_max31865
import requests
import threading
import time
@ -29,15 +26,16 @@ load_dotenv()
set_point = float(os.environ.get('SET_POINT'))
sleep_timer = 1
tick_threshold = 5
spi = board.SPI()
cs = digitalio.DigitalInOut(getattr(board,os.environ.get('INPUT_PIN')))
sensor = adafruit_max31865.MAX31865(spi, cs, wires=3)
class tempThread (threading.Thread):
class tempThread(threading.Thread):
def run(self):
ticks = 0
while True:
temp = sensor.temperature
print('Flag 0')
sensor = requests.get(os.environ.get('SENSOR_URL')).json()
print(sensor)
temp = sensor['temperature']
print(temp)
if temp >= set_point:
ticks += 1
else: