forked from mverleun/RTL433-to-mqtt
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathconfig.py
36 lines (27 loc) · 848 Bytes
/
config.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# Config section
# Fill in the next 2 lines if your MQTT server expected authentication
import os
from os import environ
MQTT_USER=""
MQTT_PASS=""
MQTT_HOST="mqtt.example.com"
MQTT_PORT=1883
MQTT_TOPIC="sensors/rtl_433"
MQTT_QOS=0
DEBUG=False # Change to True to log all MQTT messages
# End config section
if "MQTT_USER" in os.environ:
MQTT_USER = os.environ.get("MQTT_USER")
if "MQTT_PASS" in os.environ:
MQTT_PASS = os.environ.get("MQTT_PASS")
if "MQTT_HOST" in os.environ:
MQTT_HOST = os.environ.get("MQTT_HOST")
if "MQTT_PORT" in os.environ:
MQTT_PORT = os.environ.get("MQTT_PORT")
if "MQTT_TOPIC" in os.environ:
MQTT_TOPIC = os.environ.get("MQTT_TOPIC")
if "MQTT_QOS" in os.environ:
MQTT_QOS = os.environ.get("MQTT_QOS")
if "DEBUG" in os.environ:
DEBUG = os.environ.get("DEBUG")
MQTT_PORT = int(MQTT_PORT)