Update to use sensor endpoints
This commit is contained in:
parent
909a440dc4
commit
b10194e6ed
@ -1,7 +1,5 @@
|
|||||||
XMPP_RECEIVER=
|
NOTIF_URL=
|
||||||
XMPP_SENDER=
|
SENSOR_URL=
|
||||||
XMPP_SENDER_PASSWORD=
|
|
||||||
INPUT_PIN=
|
|
||||||
SET_POINT=82.22
|
SET_POINT=82.22
|
||||||
MESSAGE="The water is too damn hot! :tea:"
|
MESSAGE="The water is too damn hot! :tea:"
|
||||||
|
|
||||||
|
@ -1,6 +1,3 @@
|
|||||||
Adafruit_Blinka==6.16.0
|
|
||||||
adafruit_circuitpython_max31865==2.2.10
|
|
||||||
Flask==1.1.2
|
Flask==1.1.2
|
||||||
python-dotenv==0.20.0
|
python-dotenv==0.20.0
|
||||||
requests==2.25.1
|
requests==2.25.1
|
||||||
xmpppy==0.7.0
|
|
||||||
|
12
temperato.py
12
temperato.py
@ -14,9 +14,6 @@
|
|||||||
# You should have received a copy of the GNU General Public License along
|
# You should have received a copy of the GNU General Public License along
|
||||||
# with this program. If not, see <https://www.gnu.org/licenses/>.
|
# with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
import board
|
|
||||||
import digitalio
|
|
||||||
import adafruit_max31865
|
|
||||||
import requests
|
import requests
|
||||||
import threading
|
import threading
|
||||||
import time
|
import time
|
||||||
@ -29,15 +26,16 @@ load_dotenv()
|
|||||||
set_point = float(os.environ.get('SET_POINT'))
|
set_point = float(os.environ.get('SET_POINT'))
|
||||||
sleep_timer = 1
|
sleep_timer = 1
|
||||||
tick_threshold = 5
|
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):
|
def run(self):
|
||||||
ticks = 0
|
ticks = 0
|
||||||
while True:
|
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:
|
if temp >= set_point:
|
||||||
ticks += 1
|
ticks += 1
|
||||||
else:
|
else:
|
||||||
|
Loading…
Reference in New Issue
Block a user