Debug flag now set in config file

This commit is contained in:
2026-04-11 00:42:43 +02:00
parent 50c947e3d8
commit 787a922bd6

View File

@@ -42,8 +42,11 @@ def log(level, msg):
print(f"[{_ts()}] {level:5s} {msg}") print(f"[{_ts()}] {level:5s} {msg}")
_DEBUG = False
def info(msg): def info(msg):
if _cfg.get("debug", False): if _DEBUG:
log("INFO", msg) log("INFO", msg)
@@ -76,6 +79,10 @@ def _load_config():
_cfg = _load_config() _cfg = _load_config()
DEBUG = _cfg.get("debug", False)
global _DEBUG
_DEBUG = DEBUG
WIFI_SSID = _cfg["wifi_ssid"] WIFI_SSID = _cfg["wifi_ssid"]
WIFI_PASSWORD = _cfg["wifi_password"] WIFI_PASSWORD = _cfg["wifi_password"]
MQTT_BROKER = _cfg["mqtt_broker"] MQTT_BROKER = _cfg["mqtt_broker"]