From c80c4ac4fa2231b991b08ac537a67653d181da5a Mon Sep 17 00:00:00 2001 From: Morg42 <43153739+Morg42@users.noreply.github.com> Date: Wed, 14 Feb 2024 18:51:42 +0100 Subject: [PATCH] fix error --- bin/smarthome.py | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/bin/smarthome.py b/bin/smarthome.py index 0d5f01f73a..bb1ef78b0b 100755 --- a/bin/smarthome.py +++ b/bin/smarthome.py @@ -84,7 +84,6 @@ arggroup.add_argument('-q', '--quiet', help='reduce logging to the logfile - DEPRECATED use logging-configuration', action='store_true') args = argparser.parse_args() - ##################################################################### # Import Python Core Modules ##################################################################### @@ -259,8 +258,6 @@ def _reload_logics(): if args.config_dir is not None: extern_conf_dir = os.path.normpath(args.config_dir) - config_etc = args.config_etc is not None - lib.backup.make_backup_directories(BASE) if args.restart: @@ -287,7 +284,7 @@ def _reload_logics(): pass atexit.register(readline.write_history_file, histfile) readline.parse_and_bind("tab: complete") - sh = SmartHome(MODE=MODE, extern_conf_dir=extern_conf_dir, config_etc=config_etc) + sh = SmartHome(MODE=MODE, extern_conf_dir=extern_conf_dir, config_etc=args.config_etc) _sh_thread = threading.Thread(target=sh.start) _sh_thread.start() shell = code.InteractiveConsole(locals()) @@ -316,17 +313,17 @@ def _reload_logics(): MODE = 'foreground' pass elif args.create_backup: - fn = lib.backup.create_backup(extern_conf_dir, BASE, config_etc=config_etc) + fn = lib.backup.create_backup(extern_conf_dir, BASE, config_etc=args.config_etc) if fn: print("Backup of configuration created at: \n{}".format(fn)) exit(0) elif args.create_backup_t: - fn = lib.backup.create_backup(extern_conf_dir, BASE, filename_with_timestamp=True, config_etc=config_etc) + fn = lib.backup.create_backup(extern_conf_dir, BASE, filename_with_timestamp=True, config_etc=args.config_etc) if fn: print("Backup of configuration created at: \n{}".format(fn)) exit(0) elif args.restore_backup: - fn = lib.backup.restore_backup(extern_conf_dir, BASE, config_etc=config_etc) + fn = lib.backup.restore_backup(extern_conf_dir, BASE, config_etc=args.config_etc) if fn is not None: print("Configuration has been restored from: \n{}".format(fn)) print("Restart SmartHomeNG to use the restored configuration") @@ -339,6 +336,6 @@ def _reload_logics(): if MODE == 'debug': lib.daemon.write_pidfile(psutil.Process().pid, PIDFILE) # Starting SmartHomeNG - sh = SmartHome(MODE=MODE, extern_conf_dir=extern_conf_dir, config_etc=config_etc) + sh = SmartHome(MODE=MODE, extern_conf_dir=extern_conf_dir, config_etc=args.config_etc) sh.start()