default bridge hostname can now be stored in a 'bridge' file.

This commit is contained in:
joost witteveen 2022-04-28 11:29:36 +02:00
parent 91315b4b77
commit 88ae5dbd5a
1 changed files with 4 additions and 2 deletions

6
hue.py
View File

@ -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)