From 4799f456a63cb58c09168ab82eee36474c23328e Mon Sep 17 00:00:00 2001 From: Giorgio Ravera Date: Tue, 5 Jan 2021 11:13:22 +0100 Subject: [PATCH] Reviewed Readme.md and info.md and increment version --- README.md | 12 ++++++++++-- const.py | 2 +- custom_components/mercedesmeapi/config.py | 2 -- custom_components/mercedesmeapi/const.py | 2 +- custom_components/mercedesmeapi/resources.py | 8 +++++--- info.md | 12 ++++++++++-- mercedes_me_api.sh | 4 ++-- 7 files changed, 29 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index be823ef..dc82376 100644 --- a/README.md +++ b/README.md @@ -48,7 +48,15 @@ mercedesmeapi: enable_resources_file: <**ENABLE (true) OR DISABLE (false) RESOURCES - OPTIONAL (DEFAULT DISABLED)**> scan_interval: <** TIME PERIOD (NUMBER OF SECONDS) TO REFRESH RESOURCES - OPTIONAL**> ``` -2) Actually it's not possible to retrieve the token from scratch. Please use the other script to retrieve the first token and copy it into hacs folder (.mercedesme_token) +2) Actually it's not possible to retrieve the token from scratch. Please use the other scripts to retrieve the first token and copy it (.mercedesme_token) into the homeassistant configuration folder, in the same path where configuration.yaml is located + +### Debug +To enable advanced log please expand the logger module configuration with the following lines: +```yaml +logger: + logs: + custom_components.mercedesmeapi: debug +``` ## Shell Scripts There are two shell script: @@ -120,7 +128,7 @@ You can find change log under [releases][releases-url] [releases-url]: https://github.com/xraver/mercedes_me_api/releases [last-commit-img]: https://img.shields.io/github/last-commit/xraver/mercedes_me_api [last-commit-url]: https://github.com/xraver/mercedes_me_api/commits/master -[hacs-img]: https://img.shields.io/badge/HACS-Custom-orange.svg +[hacs-img]: https://img.shields.io/badge/HACS-Default-orange.svg [hacs-url]: https://github.com/custom-components/hacs [buymecoffee-img]: https://img.shields.io/badge/buy%20me%20a%20coffee-donate-yellow.svg [buymecoffee-button]: https://www.buymeacoffee.com/assets/img/guidelines/download-assets-sm-2.svg diff --git a/const.py b/const.py index 3ef1061..42a5ff7 100644 --- a/const.py +++ b/const.py @@ -9,7 +9,7 @@ https://github.com/xraver/mercedes_me_api/ # Software Name & Version NAME = "Mercedes Me API" DOMAIN = "mercedesmeapi" -VERSION = "0.9" +VERSION = "0.10" # Software Parameters TOKEN_FILE = ".mercedesme_token" CONFIG_FILE = ".mercedesme_config" diff --git a/custom_components/mercedesmeapi/config.py b/custom_components/mercedesmeapi/config.py index 312f7f2..38f1570 100644 --- a/custom_components/mercedesmeapi/config.py +++ b/custom_components/mercedesmeapi/config.py @@ -10,8 +10,6 @@ import logging from homeassistant.const import ( CONF_SCAN_INTERVAL, -# LENGTH_KILOMETERS, -# LENGTH_MILES, ) from .const import * diff --git a/custom_components/mercedesmeapi/const.py b/custom_components/mercedesmeapi/const.py index 54a6bdc..e489f02 100644 --- a/custom_components/mercedesmeapi/const.py +++ b/custom_components/mercedesmeapi/const.py @@ -9,7 +9,7 @@ https://github.com/xraver/mercedes_me_api/ # Software Name & Version NAME = "Mercedes Me API" DOMAIN = "mercedesmeapi" -VERSION = "0.9" +VERSION = "0.10" # Software Parameters TOKEN_FILE = ".mercedesme_token" RESOURCES_FILE = ".mercedesme_resources" diff --git a/custom_components/mercedesmeapi/resources.py b/custom_components/mercedesmeapi/resources.py index e68467b..cf5f23a 100644 --- a/custom_components/mercedesmeapi/resources.py +++ b/custom_components/mercedesmeapi/resources.py @@ -111,7 +111,7 @@ class MercedesMeResources: found = False resources = None - if (self.mercedesConfig.enable_resources_file == True): + if self.mercedesConfig.enable_resources_file == True: if not os.path.isfile(self.resources_file): # Resources File not present - Retrieving new one from server _LOGGER.error("Resource File missing - Creating a new one.") @@ -125,7 +125,9 @@ class MercedesMeResources: else: found = True except ValueError: - _LOGGER.error("Error reading resource file - Creating a new one.") + _LOGGER.error( + "Error reading resource file - Creating a new one." + ) found = False if not found: @@ -210,7 +212,7 @@ class MercedesMeResources: # Write Resources File ######################## def WriteResourcesFile(self): - if (self.mercedesConfig.enable_resources_file == True): + if self.mercedesConfig.enable_resources_file == True: output = [] # Extract List for res in self.database: diff --git a/info.md b/info.md index 4632a6a..48ffd46 100644 --- a/info.md +++ b/info.md @@ -48,7 +48,15 @@ mercedesmeapi: enable_resources_file: <**ENABLE (true) OR DISABLE (false) RESOURCES - OPTIONAL (DEFAULT DISABLED)**> scan_interval: <** TIME PERIOD (NUMBER OF SECONDS) TO REFRESH RESOURCES - OPTIONAL**> ``` -2) Actually it's not possible to retrieve the token from scratch. Please use the other script to retrieve the first token and copy it into hacs folder (.mercedesme_token) +2) Actually it's not possible to retrieve the token from scratch. Please use the other scripts to retrieve the first token and copy it (.mercedesme_token) into the homeassistant configuration folder, in the same path where configuration.yaml is located + +## Debug +To enable advanced log please expand the logger module configuration with the following lines: +```yaml +logger: + logs: + custom_components.mercedesmeapi: debug +``` ## Change Log You can find change log under [releases][releases-url] @@ -68,7 +76,7 @@ You can find change log under [releases][releases-url] [releases-url]: https://github.com/xraver/mercedes_me_api/releases [last-commit-img]: https://img.shields.io/github/last-commit/xraver/mercedes_me_api [last-commit-url]: https://github.com/xraver/mercedes_me_api/commits/master -[hacs-img]: https://img.shields.io/badge/HACS-Custom-orange.svg +[hacs-img]: https://img.shields.io/badge/HACS-Default-orange.svg [hacs-url]: https://github.com/custom-components/hacs [buymecoffee-img]: https://img.shields.io/badge/buy%20me%20a%20coffee-donate-yellow.svg [buymecoffee-button]: https://www.buymeacoffee.com/assets/img/guidelines/download-assets-sm-2.svg diff --git a/mercedes_me_api.sh b/mercedes_me_api.sh index 5d236a5..18419d5 100755 --- a/mercedes_me_api.sh +++ b/mercedes_me_api.sh @@ -22,7 +22,7 @@ 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" -URL_RES_PREFIX="https://api.mercedes-benz.com/vehicledata/v2" +RES_URL_PREFIX="https://api.mercedes-benz.com/vehicledata/v2" # Resources RES_FUEL=(rangeliquid tanklevelpercent) RES_LOCK=(doorlockstatusvehicle doorlockstatusdecklid doorlockstatusgas positionHeading) @@ -56,7 +56,7 @@ if [ -z $CLIENT_ID ] | [ -z $CLIENT_ID ] | [ -z $CLIENT_ID ]; then fi # Formatting RES_URL -RES_URL="$URL_RES_PREFIX/vehicles/$VEHICLE_ID/resources" +RES_URL="$RES_URL_PREFIX/vehicles/$VEHICLE_ID/resources" function usage () { -- 2.47.3