From f2aa1fcf693597cb3c58b80af546a3cca38643b3 Mon Sep 17 00:00:00 2001 From: Mark Date: Tue, 23 Jul 2024 02:18:44 +0200 Subject: [PATCH] Add time zone arg to config init --- BridgeEmulator/configManager/argumentHandler.py | 11 ++++++++++- BridgeEmulator/configManager/configHandler.py | 10 +++++----- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/BridgeEmulator/configManager/argumentHandler.py b/BridgeEmulator/configManager/argumentHandler.py index c0ea7b0a7..3f8068684 100644 --- a/BridgeEmulator/configManager/argumentHandler.py +++ b/BridgeEmulator/configManager/argumentHandler.py @@ -35,7 +35,8 @@ def process_arguments(configDir, args): def parse_arguments(): argumentDict = {"BIND_IP": '', "HOST_IP": '', "HTTP_PORT": '', "HTTPS_PORT": '', "FULLMAC": '', "MAC": '', "DEBUG": False, "DOCKER": False, - "IP_RANGE_START": '', "IP_RANGE_END": '', "DECONZ": '', "scanOnHostIP": False, "disableOnlineDiscover": '', "noLinkButton": False, "noServeHttps": False} + "IP_RANGE_START": '', "IP_RANGE_END": '', "DECONZ": '', "scanOnHostIP": False, "disableOnlineDiscover": '', "noLinkButton": False, + "noServeHttps": False, "TZ": ''} ap = argparse.ArgumentParser() # Arguements can also be passed as Environment Variables. @@ -55,6 +56,7 @@ def parse_arguments(): ap.add_argument("--no-link-button", action='store_true', help="DANGEROUS! Don't require the link button to be pressed to pair the Hue app, just allow any app to connect") ap.add_argument("--disable-online-discover", help="Disable Online and Remote API functions") + ap.add_argument("--TZ", help="Set time zone", type=str) args = ap.parse_args() @@ -84,6 +86,13 @@ def parse_arguments(): bind_ip = get_environment_variable('BIND_IP') argumentDict["BIND_IP"] = bind_ip + tz = "Europe/London" + if args.TZ: + tz = args.TZ + elif get_environment_variable('TZ'): + tz = get_environment_variable('TZ') + argumentDict["TZ"] = tz + if args.ip: host_ip = args.ip elif get_environment_variable('IP'): diff --git a/BridgeEmulator/configManager/configHandler.py b/BridgeEmulator/configManager/configHandler.py index 491b3c8c3..c2580df51 100644 --- a/BridgeEmulator/configManager/configHandler.py +++ b/BridgeEmulator/configManager/configHandler.py @@ -92,9 +92,9 @@ def load_config(self): } if int(config["swversion"]) < 1958077010: - config["swversion"] = "1962154010" + config["swversion"] = "1965053040" if float(config["apiversion"][:3]) < 1.56: - config["apiversion"] = "1.62.0" + config["apiversion"] = "1.65.0" self.yaml_config["config"] = config else: @@ -107,11 +107,11 @@ def load_config(self): "alarm":{"enabled": False,"lasttriggered": 0}, "port":{"enabled": False,"ports": [80]}, "apiUsers":{}, - "apiversion":"1.62.0", + "apiversion":"1.65.0", "name":"DiyHue Bridge", "netmask":"255.255.255.0", - "swversion":"1962154010", - "timezone":"Europe/London", + "swversion":"1965053040", + "timezone":parse_arguments()["TZ"], "linkbutton":{"lastlinkbuttonpushed": 1599398980}, "users":{"admin@diyhue.org":{"password":"pbkdf2:sha256:150000$bqqXSOkI$199acdaf81c18f6ff2f29296872356f4eb78827784ce4b3f3b6262589c788742"}}, "hue": {},