Skip to content

Commit

Permalink
Add time zone arg to config init
Browse files Browse the repository at this point in the history
  • Loading branch information
hendriksen-mark committed Jul 23, 2024
1 parent 0f68322 commit f2aa1fc
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
11 changes: 10 additions & 1 deletion BridgeEmulator/configManager/argumentHandler.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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()

Expand Down Expand Up @@ -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'):
Expand Down
10 changes: 5 additions & 5 deletions BridgeEmulator/configManager/configHandler.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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":{"[email protected]":{"password":"pbkdf2:sha256:150000$bqqXSOkI$199acdaf81c18f6ff2f29296872356f4eb78827784ce4b3f3b6262589c788742"}},
"hue": {},
Expand Down

0 comments on commit f2aa1fc

Please sign in to comment.