Add id to client

This commit is contained in:
Ruben van de Ven 2019-03-07 21:34:50 +01:00
parent 85552a3294
commit 3eb4c78ae4
2 changed files with 10 additions and 4 deletions

View file

@ -274,9 +274,9 @@ class Hugvey(object):
"""The Hugvey client, to be ran on the Raspberry Pi's """The Hugvey client, to be ran on the Raspberry Pi's
""" """
def __init__(self): def __init__(self, id = None):
self.id = self.getId() self.id = self.getId() if id is None else id
pass logger.debug(f'Hugvey {self.id}')
def getId(self) -> int: def getId(self) -> int:
"""Get Hugvey ID from hostname""" """Get Hugvey ID from hostname"""

View file

@ -16,6 +16,12 @@ if __name__ == '__main__':
'-v', '-v',
action="store_true", action="store_true",
) )
argParser.add_argument(
'--id',
type=int,
default=None,
help="Force the given id to be used. Must be integer"
)
args = argParser.parse_args() args = argParser.parse_args()
@ -23,6 +29,6 @@ if __name__ == '__main__':
level=logging.DEBUG if args.verbose else logging.INFO, level=logging.DEBUG if args.verbose else logging.INFO,
) )
hv = Hugvey() hv = Hugvey(args.id)
hv.loadConfig(args.config) hv.loadConfig(args.config)
hv.start() hv.start()