From b10194e6ed5f1bce9d4bb15e8fe8686a319e88bb Mon Sep 17 00:00:00 2001 From: William Moore Date: Sun, 22 May 2022 20:22:30 -0500 Subject: [PATCH] Update to use sensor endpoints --- .env.template | 6 ++---- requirements.txt | 3 --- temperato.py | 14 ++++++-------- 3 files changed, 8 insertions(+), 15 deletions(-) diff --git a/.env.template b/.env.template index f45841c..feb59f0 100644 --- a/.env.template +++ b/.env.template @@ -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:" diff --git a/requirements.txt b/requirements.txt index d64c09e..ccfd9ed 100644 --- a/requirements.txt +++ b/requirements.txt @@ -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 diff --git a/temperato.py b/temperato.py index a0ae993..00ba128 100644 --- a/temperato.py +++ b/temperato.py @@ -14,9 +14,6 @@ # You should have received a copy of the GNU General Public License along # with this program. If not, see . -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: