From 4ad7f2e5111ca9e27dcbe5781c87f249bc7377ad Mon Sep 17 00:00:00 2001 From: Dennis Eriksen Date: Thu, 9 Nov 2023 13:57:26 +0100 Subject: added new function to get env which handles missing env better... --- scripts/mqtt_listener.py | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'scripts/mqtt_listener.py') diff --git a/scripts/mqtt_listener.py b/scripts/mqtt_listener.py index 3ee688d..1ff3176 100644 --- a/scripts/mqtt_listener.py +++ b/scripts/mqtt_listener.py @@ -2,18 +2,17 @@ """ Listen for mqtt-events, and trigger for some """ import json -import os from datetime import datetime import common import paho.mqtt.client as mqtt -mqtt_server = os.environ["el_mqtt_server"] -mqtt_port = int(os.environ["el_mqtt_port"]) -keepalive = int(os.environ["el_mqtt_keepalive"]) -mqtt_topic = os.environ["el_mqtt_topic"] -mqtt_user = os.environ["el_mqtt_user"] -mqtt_pass = os.environ["el_mqtt_pass"] +mqtt_server = common.env("el_mqtt_server") +mqtt_port = int(common.env("el_mqtt_port")) +keepalive = int(common.env("el_mqtt_keepalive")) +mqtt_topic = common.env("el_mqtt_topic") +mqtt_user = common.env("el_mqtt_user") +mqtt_pass = common.env("el_mqtt_pass") tempsensors = [ "Bad Temp", -- cgit v1.2.3