add possibility to disable remote control

This commit is contained in:
Florian Bezannier
2020-11-20 14:25:06 +01:00
parent 58ff71ac02
commit 57366fb411
2 changed files with 10 additions and 5 deletions
+1 -1
View File
@@ -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
+9 -4
View File
@@ -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()