From 42a5956d636c7be1fc71f8ac1fd9c925f29acdcf Mon Sep 17 00:00:00 2001 From: William Moore Date: Wed, 2 Mar 2022 21:11:56 -0600 Subject: [PATCH] Make the message configurable --- systemd/temperato.service | 1 + temperato.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/systemd/temperato.service b/systemd/temperato.service index 4f4dfcb..40c5c89 100644 --- a/systemd/temperato.service +++ b/systemd/temperato.service @@ -5,6 +5,7 @@ Description=Temperato Service Environment=NOTIF_URL= Environment=CHANNEL_ID= Environment=ACCESS_TOKEN= +Environment=MESSAGE= ExecStart=python3 temperato.py ExecReload=python3 temperato.py KillMode=process diff --git a/temperato.py b/temperato.py index e8afd4e..981f4f9 100644 --- a/temperato.py +++ b/temperato.py @@ -36,7 +36,7 @@ class tempThread (threading.Thread): temp = sensor.temperature if temp >= set_point: 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) T_thread = tempThread()