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
"""
def __init__(self):
self.id = self.getId()
pass
def __init__(self, id = None):
self.id = self.getId() if id is None else id
logger.debug(f'Hugvey {self.id}')
def getId(self) -> int:
"""Get Hugvey ID from hostname"""

View File

@ -16,6 +16,12 @@ if __name__ == '__main__':
'-v',
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()
@ -23,6 +29,6 @@ if __name__ == '__main__':
level=logging.DEBUG if args.verbose else logging.INFO,
)
hv = Hugvey()
hv = Hugvey(args.id)
hv.loadConfig(args.config)
hv.start()