SolarEnergy/python_device/src/args.py

27 lines
921 B
Python

import argparse
import os
parser = argparse.ArgumentParser(description="SolarEnergy Python-based client")
parser.add_argument(
"--unsecure_origin",
help="Change unsecure API origin",
default="http://localhost:8080",
)
parser.add_argument("--storage", help="Change storage location", default="storage")
parser.add_argument(
"--relay_gpios",
help="Comma-separated list of GPIO used to modify relays",
default="5,6,7",
)
args = parser.parse_args()
args.secure_origin_path = os.path.join(args.storage, "SECURE_ORIGIN")
args.root_ca_path = os.path.join(args.storage, "root_ca.crt")
args.dev_id_path = os.path.join(args.storage, "DEV_ID")
args.dev_priv_key_path = os.path.join(args.storage, "dev.key")
args.dev_csr_path = os.path.join(args.storage, "dev.csr")
args.dev_crt_path = os.path.join(args.storage, "dev.crt")
args.relay_gpios_list = list(map(lambda x: int(x), args.relay_gpios.split(",")))