Make the message configurable
This commit is contained in:
parent
ce562af54f
commit
42a5956d63
@ -5,6 +5,7 @@ Description=Temperato Service
|
|||||||
Environment=NOTIF_URL=<your mattermost incoming webhook>
|
Environment=NOTIF_URL=<your mattermost incoming webhook>
|
||||||
Environment=CHANNEL_ID=<your mattermost channel id>
|
Environment=CHANNEL_ID=<your mattermost channel id>
|
||||||
Environment=ACCESS_TOKEN=<your mattermost access token>
|
Environment=ACCESS_TOKEN=<your mattermost access token>
|
||||||
|
Environment=MESSAGE=<your mattermost message>
|
||||||
ExecStart=python3 temperato.py
|
ExecStart=python3 temperato.py
|
||||||
ExecReload=python3 temperato.py
|
ExecReload=python3 temperato.py
|
||||||
KillMode=process
|
KillMode=process
|
||||||
|
@ -36,7 +36,7 @@ class tempThread (threading.Thread):
|
|||||||
temp = sensor.temperature
|
temp = sensor.temperature
|
||||||
if temp >= set_point:
|
if temp >= set_point:
|
||||||
print('Bearer ' + os.environ.get('ACCESS_TOKEN'))
|
print('Bearer ' + os.environ.get('ACCESS_TOKEN'))
|
||||||
print(requests.post(os.environ.get('NOTIF_URL'), headers={'Content-Type': 'application/json', 'Authorization': 'Bearer ' + os.environ.get('ACCESS_TOKEN')}, data=json.dumps({'message': '@all The water is too damn hot!', 'channel_id': os.environ.get('CHANNEL_ID')}), timeout=5))
|
print(requests.post(os.environ.get('NOTIF_URL'), headers={'Content-Type': 'application/json', 'Authorization': 'Bearer ' + os.environ.get('ACCESS_TOKEN')}, data=json.dumps({'message': '@all ' + os.environ.get('MESSAGE'), 'channel_id': os.environ.get('CHANNEL_ID')}), timeout=5))
|
||||||
time.sleep(sleep_timer)
|
time.sleep(sleep_timer)
|
||||||
|
|
||||||
T_thread = tempThread()
|
T_thread = tempThread()
|
||||||
|
Loading…
Reference in New Issue
Block a user