diff --git a/README.md b/README.md index 3ab9125..3ef484e 100644 --- a/README.md +++ b/README.md @@ -90,7 +90,7 @@ We need to get credentials from the MyPeugeot app. You have two solutions : ``python3 server.py -f test.json -c charge_control1.json`` if you choose solution 2 : - ``python3 server.py -f test.json`` + ``python3 server.py -f test.json --remote-disable`` 3. Test it diff --git a/server.py b/server.py index 4d2fdf7..ebf70e3 100644 --- a/server.py +++ b/server.py @@ -75,6 +75,7 @@ def parse_args(): parser.add_argument("-f", "--config", help="config file", type=argparse.FileType('r')) parser.add_argument("-c", "--charge-control", help="enable charge control", const="charge_config.json", nargs='?') parser.add_argument("-d", "--debug", help="enable debug", const=10, default=20, nargs='?') + parser.add_argument("--remote-disable",help="disable remote control") parser.parse_args() return parser @@ -95,10 +96,14 @@ if __name__ == "__main__": client_paswword = input("mypeugeot password: ") myp.connect(client_email, client_paswword) logger.info(myp.get_vehicles()) - myp.start_mqtt() t1 = Thread(target=app.run) t1.start() + if args.remote_disable: + logger.info("mqtt disabled") + else: + myp.start_mqtt() + if args.charge_control: + chc = ChargeControls.load_config(myp, name=args.charge_control) + chc.start() save_config(myp) - if args.charge_control: - chc = ChargeControls.load_config(myp, name=args.charge_control) - chc.start() +