Major overhaul

This commit is contained in:
William Moore 2022-04-09 04:07:09 -05:00
parent 0facdf9ad5
commit caa5c088cc
5 changed files with 31 additions and 7 deletions

6
.env.template Normal file
View File

@ -0,0 +1,6 @@
XMPP_RECEIVER=
XMPP_SENDER=
XMPP_SENDER_PASSWORD=
SET_POINT=82.22
MESSAGE="The water is too damn hot! :tea:"

6
requirements.txt Normal file
View File

@ -0,0 +1,6 @@
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

@ -0,0 +1,14 @@
[Unit]
Description=Temperato Host Service
[Service]
Environment=FLASK_APP=web
ExecStart=flask run
ExecReload=flask run
KillMode=process
Restart=on-failure
Type=simple
WorkingDirectory=<your path>
[Install]
WantedBy=multi-user.target

View File

@ -2,10 +2,6 @@
Description=Temperato Service
[Service]
Environment=NOTIF_URL=<your mattermost incoming webhook>
Environment=CHANNEL_ID=<your mattermost channel id>
Environment=ACCESS_TOKEN=<your mattermost access token>
Environment=MESSAGE=<your mattermost message>
ExecStart=python3 temperato.py
ExecReload=python3 temperato.py
KillMode=process

View File

@ -23,13 +23,15 @@ import time
import os
import json
import xmpp
from dotenv import load_dotenv
set_point = 82.22
load_dotenv()
set_point = float(os.environ.get('SET_POINT'))
sleep_timer = 1
tick_threshold = 5
spi = board.SPI()
cs = digitalio.DigitalInOut(board.D26)
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)