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_watch.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'scripts/mqtt_watch.py') diff --git a/scripts/mqtt_watch.py b/scripts/mqtt_watch.py index e2c4e21..22105c6 100644 --- a/scripts/mqtt_watch.py +++ b/scripts/mqtt_watch.py @@ -1,17 +1,17 @@ #!/usr/bin/env python3 """ Listen for mqtt-events, and trigger for some """ -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") # The callback for when the client receives a CONNACK response from the server. -- cgit v1.2.3