From 78ec594bd1762066ceca5771d88fa426d8dfbc93 Mon Sep 17 00:00:00 2001 From: Giorgio Ravera Date: Mon, 19 Dec 2022 23:26:54 +0100 Subject: [PATCH] Minor fixes and updated file version --- README.md | 8 ++++---- const.py | 2 +- custom_components/mercedesmeapi/manifest.json | 7 +++++-- mercedes_me_api.sh | 15 ++++++++------- 4 files changed, 18 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index f74c281..48bd826 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# mercedes_me_api +# mercedes_me_api [![Releases][releases-img]][releases-url] [![Last Commit][last-commit-img]][last-commit-url] [![hacs][hacs-img]][hacs-url] @@ -13,11 +13,11 @@ This repository contains a collection of scripts (including the Home Assistant C 3) Register to the following APIs (all of them): - [Electric Vehicle Status](https://developer.mercedes-benz.com/products/electric_vehicle_status) - [Fuel Status](https://developer.mercedes-benz.com/products/fuel_status) - - [Pay As You Drive Insurance](https://developer.mercedes-benz.com/products/pay_as_you_drive_insurance) + - [Pay As You Drive Insurance](https://developer.mercedes-benz.com/products/pay_as_you_drive_insurance) - [Vehicle Lock Status](https://developer.mercedes-benz.com/products/vehicle_lock_status) - [Vehicle Status](https://developer.mercedes-benz.com/products/vehicle_status) -Notes: +Notes: 1) the APIs described above do not require any subscription in case you use them with your own car associated with the Mercedes me Account. 2) not all sensors may be available in your own car; if a sensor is not available the data request returns no data. 3) only one car is supported for the moment. @@ -49,7 +49,7 @@ 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 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 +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: diff --git a/const.py b/const.py index 4134f20..250ccb0 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.11" +VERSION = "0.12" # Software Parameters TOKEN_FILE = ".mercedesme_token" CONFIG_FILE = ".mercedesme_config" diff --git a/custom_components/mercedesmeapi/manifest.json b/custom_components/mercedesmeapi/manifest.json index 46f97e2..9b5edcf 100644 --- a/custom_components/mercedesmeapi/manifest.json +++ b/custom_components/mercedesmeapi/manifest.json @@ -3,7 +3,10 @@ "name": "Mercedes Me API", "documentation": "https://github.com/xraver/mercedes_me_api/blob/master/README.md", "issue_tracker": "https://github.com/xraver/mercedes_me_api/issues", + "requirements": [], + "dependencies": [], "config_flow": false, - "version": "0.11", - "codeowners": [ "@xraver" ] + "version": "0.12", + "codeowners": [ "@xraver" ], + "iot_class": "cloud_push" } diff --git a/mercedes_me_api.sh b/mercedes_me_api.sh index c41d8a2..a98ff7a 100755 --- a/mercedes_me_api.sh +++ b/mercedes_me_api.sh @@ -1,7 +1,7 @@ #!/bin/bash # Author: G. Ravera -# Version 0.5 +# Version 0.7 # Creation Date: 28/09/2020 # # Change log: @@ -11,6 +11,7 @@ # 18/12/2020 - 0.4 - Added macOS support (robert@klep.name) # 19/12/2020 - 0.5 - Added Electric Vehicle Status support # 23/12/2020 - 0.6 - Added PayAsYouDrive support (danielrheinbay@gmail.com) +# 19/12/2022 - 0.7 - Updated URLs (samfaitmalomolet) # Script Name & Version NAME="mercedes_me_api.sh" @@ -95,7 +96,7 @@ function parse_options () shift ;; -r | --refresh ) - refreshAuthCode + refreshAuthCode shift ;; -f | --fuel ) @@ -133,15 +134,15 @@ function generateBase64 () BASE64=$(echo $BASE64 | sed $SED_FLAG 's/ //') } -function getAuthCode () +function getAuthCode () { generateBase64 - + echo "Open the browser and insert this link:" - echo + echo echo "https://ssoalpha.dvb.corpinter.net/v1/auth?response_type=code&client_id=$CLIENT_ID&redirect_uri=$REDIRECT_URL&scope=$SCOPE" #echo "https://ssoalpha.dvb.corpinter.net/v1/auth?response_type=code&client_id=$CLIENT_ID&redirect_uri=$REDIRECT_URL&scope=$SCOPE&state=$STATE" - echo + echo echo "Copy the code in the url:" read AUTH_CODE @@ -161,7 +162,7 @@ function refreshAuthCode () extractRefreshToken TOKEN=$(curl --request POST \ - --url https://id.mercedes-benz.com/as/token.oauth2 \ + --url https://ssoalpha.dvb.corpinter.net/v1/token \ --header "Authorization: Basic $BASE64" \ --header "content-type: application/x-www-form-urlencoded" \ --data "grant_type=refresh_token&refresh_token=$REFRESH_CODE") -- 2.47.3