diff --git a/nspanel-lovelace-ui/config.yaml b/nspanel-lovelace-ui/config.yaml index c55cd0cc..683da1aa 100644 --- a/nspanel-lovelace-ui/config.yaml +++ b/nspanel-lovelace-ui/config.yaml @@ -1,6 +1,6 @@ # https://developers.home-assistant.io/docs/add-ons/configuration#add-on-config name: NSPanel Lovelace UI Addon -version: "4.7.83" +version: "4.7.84" slug: nspanel-lovelace-ui description: NSPanel Lovelace UI Addon services: diff --git a/nspanel-lovelace-ui/rootfs/usr/bin/mqtt-manager/main.py b/nspanel-lovelace-ui/rootfs/usr/bin/mqtt-manager/main.py index fb61b4b1..d20cfa4f 100644 --- a/nspanel-lovelace-ui/rootfs/usr/bin/mqtt-manager/main.py +++ b/nspanel-lovelace-ui/rootfs/usr/bin/mqtt-manager/main.py @@ -16,19 +16,27 @@ from queue import Queue from mqtt import MqttManager logging.getLogger("watchdog").propagate = False - -settings = {} + +settings = {} panels = {} panel_in_queues = {} panel_out_queue = Queue(maxsize=20) last_settings_file_mtime = 0 -mqtt_connect_time = 0 -has_sent_reload_command = False - +mqtt_connect_time = 0 +has_sent_reload_command = False + +log_level_name = os.getenv("loglevel", "DEBUG").upper() +log_level = getattr(logging, log_level_name, None) +invalid_log_level = not isinstance(log_level, int) +if invalid_log_level: + log_level = logging.DEBUG + logging.basicConfig( - level=logging.DEBUG, + level=log_level, format="%(asctime)s %(levelname)s [%(threadName)s] %(name)s: %(message)s", ) +if invalid_log_level: + logging.warning("Invalid loglevel '%s', defaulting to DEBUG", log_level_name) def on_ha_update(entity_id): global panel_in_queues