Upgrade to Mattermost incoming hooks integration.
This commit is contained in:
parent
8b51d63f64
commit
74232ef4a2
@ -21,6 +21,7 @@ import requests
|
|||||||
import threading
|
import threading
|
||||||
import time
|
import time
|
||||||
import os
|
import os
|
||||||
|
import json
|
||||||
|
|
||||||
set_point = 95.0
|
set_point = 95.0
|
||||||
|
|
||||||
@ -32,9 +33,9 @@ class tempThread (threading.Thread):
|
|||||||
def run(self):
|
def run(self):
|
||||||
while True:
|
while True:
|
||||||
temp = sensor.temperature
|
temp = sensor.temperature
|
||||||
print(temp)
|
|
||||||
if temp > set_point:
|
if temp > set_point:
|
||||||
requests.post(os.environ.get('NOTIF_URL'), data={'message': 'The water is too damn hot!', 'title': 'Water temperature', 'priority': 9}, timeout=5)
|
print({'text': '@all The water is too damn hot!', 'channel': os.environ.get('CHANNEL_ID')})
|
||||||
|
print(requests.post(os.environ.get('NOTIF_URL'), headers={'Content-Type': 'application/json'}, data=json.dumps({'text': '@all The water is too damn hot!', 'channel': os.environ.get('CHANNEL_ID')})))
|
||||||
time.sleep(5)
|
time.sleep(5)
|
||||||
|
|
||||||
T_thread = tempThread()
|
T_thread = tempThread()
|
||||||
|
@ -2,7 +2,8 @@
|
|||||||
Description=Temperato Service
|
Description=Temperato Service
|
||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
Environment=NOTIF_URL=<your gotify server>
|
Environment=NOTIF_URL=<your mattermost incoming webhook>
|
||||||
|
Environment=CHANNEL_ID=<your mattermost channel id>
|
||||||
ExecStart=python3 temperato.py
|
ExecStart=python3 temperato.py
|
||||||
ExecReload=python3 temperato.py
|
ExecReload=python3 temperato.py
|
||||||
KillMode=process
|
KillMode=process
|
||||||
|
Loading…
Reference in New Issue
Block a user