Update to use more reliable endpoint concept
This commit is contained in:
parent
b7205a5009
commit
909a440dc4
@ -22,7 +22,6 @@ import threading
|
|||||||
import time
|
import time
|
||||||
import os
|
import os
|
||||||
import json
|
import json
|
||||||
import xmpp
|
|
||||||
from dotenv import load_dotenv
|
from dotenv import load_dotenv
|
||||||
|
|
||||||
load_dotenv()
|
load_dotenv()
|
||||||
@ -33,10 +32,6 @@ tick_threshold = 5
|
|||||||
spi = board.SPI()
|
spi = board.SPI()
|
||||||
cs = digitalio.DigitalInOut(getattr(board,os.environ.get('INPUT_PIN')))
|
cs = digitalio.DigitalInOut(getattr(board,os.environ.get('INPUT_PIN')))
|
||||||
sensor = adafruit_max31865.MAX31865(spi, cs, wires=3)
|
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):
|
class tempThread (threading.Thread):
|
||||||
def run(self):
|
def run(self):
|
||||||
@ -50,7 +45,7 @@ class tempThread (threading.Thread):
|
|||||||
|
|
||||||
if ticks == tick_threshold:
|
if ticks == tick_threshold:
|
||||||
ticks = 0
|
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)
|
time.sleep(sleep_timer)
|
||||||
|
|
||||||
T_thread = tempThread()
|
T_thread = tempThread()
|
||||||
|
Loading…
Reference in New Issue
Block a user