From: Giorgio Ravera Date: Sat, 26 Dec 2020 17:18:11 +0000 (+0100) Subject: Renamed credentials file to config file (breaking change) X-Git-Tag: v0.10~5 X-Git-Url: http://git.giorgioravera.it/?a=commitdiff_plain;h=377d71403a551c7848c685ecdfd20b5d257550ab;p=mercedes_me_api.git Renamed credentials file to config file (breaking change) --- diff --git a/.gitignore b/.gitignore index 5650f36..a00c847 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,5 @@ __pycache__ -.mercedesme_credentials +.mercedesme_config .mercedesme_token .mercedesme_resources *.pyc \ No newline at end of file diff --git a/README.md b/README.md index dd4785d..933d8a7 100644 --- a/README.md +++ b/README.md @@ -30,6 +30,7 @@ This component is still in development. - Config Flow for automatic configuration - Log Management - Bugfix & Software optimizations + For further details please refer to [issues list][issues-url]. ### Installation @@ -57,7 +58,7 @@ The installation is the same, the usage is different. ## Installation To use this script it's necessary to perform the following instructions: 1) clone the repository -2) create a credentials files (.mercedesme_credentials) with: +2) create a config file (.mercedesme_config) with: ```bash CLIENT_ID=<**INSERT_YOUR_CLIENT_ID**> CLIENT_SECRET=<**INSERT_YOUR_CLIENT_SECRET**> diff --git a/config.py b/config.py index 87e161d..4f698e0 100644 --- a/config.py +++ b/config.py @@ -24,7 +24,7 @@ class MercedesMeConfig: # Init ######################## def __init__(self): - self.credentials_file = CREDENTIALS_FILE + self.config_file = CONFIG_FILE self.client_id = "" self.client_secret = "" self.vin = "" @@ -36,14 +36,14 @@ class MercedesMeConfig: def ReadConfig(self): needToRefresh = False - # Read Credentials from file - if not os.path.isfile(self.credentials_file): - _LOGGER.error(f"Credential File {self.credentials_file} not found") + # Read Config from file + if not os.path.isfile(self.config_file): + _LOGGER.error(f"Credential File {self.config_file} not found") return False try: - f = ConfigObj(self.credentials_file) + f = ConfigObj(self.config_file) except Exception: - _LOGGER.error(f"Wrong {self.credentials_file} file found") + _LOGGER.error(f"Wrong {self.config_file} file found") return False # Client ID self.client_id = f.get(CONF_CLIENT_ID) diff --git a/const.py b/const.py index da2a1f1..53136e5 100644 --- a/const.py +++ b/const.py @@ -12,7 +12,7 @@ DOMAIN = "mercedesmeapi" VERSION = "0.9" # Software Parameters TOKEN_FILE = ".mercedesme_token" -CREDENTIALS_FILE = ".mercedesme_credentials" +CONFIG_FILE = ".mercedesme_config" RESOURCES_FILE = ".mercedesme_resources" # Mercedes me Application Parameters REDIRECT_URL = "https://localhost" diff --git a/custom_components/mercedesmeapi/const.py b/custom_components/mercedesmeapi/const.py index 0f028f3..60a141d 100644 --- a/custom_components/mercedesmeapi/const.py +++ b/custom_components/mercedesmeapi/const.py @@ -12,7 +12,6 @@ DOMAIN = "mercedesmeapi" VERSION = "0.9" # Software Parameters TOKEN_FILE = ".mercedesme_token" -CREDENTIALS_FILE = ".mercedesme_credentials" RESOURCES_FILE = ".mercedesme_resources" # Mercedes me Application Parameters REDIRECT_URL = "https://localhost" diff --git a/info.md b/info.md index 37ec23d..3b0d738 100644 --- a/info.md +++ b/info.md @@ -28,6 +28,7 @@ Note3: only one car is supported for the moment. - Config Flow for automatic configuration - Log Management - Bugfix & Software optimizations + For further details please refer to [issues list][issues-url]. {% if not installed %} diff --git a/mercedes_me_api.sh b/mercedes_me_api.sh index e9e0d9b..5d236a5 100755 --- a/mercedes_me_api.sh +++ b/mercedes_me_api.sh @@ -14,11 +14,11 @@ # Script Name & Version NAME="mercedes_me_api.sh" -VERSION="0.5" +VERSION="0.6" # Script Parameters TOKEN_FILE=".mercedesme_token" -CREDENTIALS_FILE=".mercedesme_credentials" +CONFIG_FILE=".mercedesme_config" # Mercedes me Application Parameters REDIRECT_URL="https://localhost" SCOPE="mb:vehicle:mbdata:fuelstatus%20mb:vehicle:mbdata:vehiclestatus%20mb:vehicle:mbdata:vehiclelock%20mb:vehicle:mbdata:evstatus%20mb:vehicle:mbdata:payasyoudrive%20offline_access" @@ -47,11 +47,11 @@ CLIENT_ID="" CLIENT_SECRET="" VEHICLE_ID="" # Loading Credentials -if [[ -f "$CREDENTIALS_FILE" ]]; then - . $CREDENTIALS_FILE +if [[ -f "$CONFIG_FILE" ]]; then + . $CONFIG_FILE fi if [ -z $CLIENT_ID ] | [ -z $CLIENT_ID ] | [ -z $CLIENT_ID ]; then - echo "Please create $CREDENTIALS_FILE with CLIENT_ID=\"\", CLIENT_SECRET=\"\", VEHICLE_ID=\"\"" + echo "Please create $CONFIG_FILE with CLIENT_ID=\"\", CLIENT_SECRET=\"\", VEHICLE_ID=\"\"" exit fi