Update to use more reliable endpoint concept

This commit is contained in:
William Moore 2022-05-03 10:21:55 -05:00
parent b7205a5009
commit 909a440dc4

View File

@ -22,7 +22,6 @@ import threading
import time
import os
import json
import xmpp
from dotenv import load_dotenv
load_dotenv()
@ -33,10 +32,6 @@ tick_threshold = 5
spi = board.SPI()
cs = digitalio.DigitalInOut(getattr(board,os.environ.get('INPUT_PIN')))
sensor = adafruit_max31865.MAX31865(spi, cs, wires=3)
jid = xmpp.protocol.JID(os.environ.get('XMPP_SENDER'))
conn = xmpp.Client(server=jid.getDomain(), debug=False)
conn.connect()
conn.auth(user=jid.getNode(), password=os.environ.get('XMPP_SENDER_PASSWORD'), resource=jid.getResource())
class tempThread (threading.Thread):
def run(self):
@ -50,7 +45,7 @@ class tempThread (threading.Thread):
if ticks == tick_threshold:
ticks = 0
conn.send(xmpp.protocol.Message(to=os.environ.get('XMPP_RECEIVER'), body=os.environ.get('MESSAGE')))
print(requests.post(os.environ.get('NOTIF_URL'), json={'message': os.environ.get('MESSAGE')}))
time.sleep(sleep_timer)
T_thread = tempThread()