From 88ae5dbd5a1bb220792bf5dd96c572d5c6527634 Mon Sep 17 00:00:00 2001 From: joost witteveen Date: Thu, 28 Apr 2022 11:29:36 +0200 Subject: [PATCH] default bridge hostname can now be stored in a 'bridge' file. --- hue.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/hue.py b/hue.py index 7ffa62f..cad2d04 100755 --- a/hue.py +++ b/hue.py @@ -219,7 +219,7 @@ def main(): parser.add_argument('--user', help='user (effectively password) at the bridge. If not given, read from file username') parser.add_argument('--bridge', - help='hostname/IP of the bridge. Default: philips-hue.local') + help='hostname/IP of the bridge. Default: philips-hue.local, or the contents of the file "bridge" in the current directory') parser.add_argument('--getuser', help='get username (security code) from bridge (after button on bridge is pressed)') @@ -252,7 +252,9 @@ def main(): #configuration if args.bridge is not None: bridgeAddr=args.bridge - + else: + if os.path.exists('bridge'): + bridgeAddr=open('bridge','r').read().strip() try: if args.getuser is not None: getuser(args.getuser)