diff --git a/CHANGELOG.md b/CHANGELOG.md index bff6f68..0ecbf40 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -36,6 +36,9 @@ app ID sent at login with `--saic-device-app-id` (`SAIC_DEVICE_APP_ID`) (#508, #509). +* Add the `mg_br` API preset for MG i-SMART LATAM (Brazil), tested on an MG4 + Urban. Requires client 0.16.0. + * Open and close a power tailgate with `doors/boot/powerTailgate/set` (`open`/`close`), also available as a Home Assistant "Power Tailgate" cover that is disabled by default. The state comes from `doors/boot`. Nothing in diff --git a/README.md b/README.md index 7eb57d8..7f828a4 100644 --- a/README.md +++ b/README.md @@ -33,7 +33,7 @@ When using combinations of configuration methods, the order of precedence is as | -u or --saic-user | SAIC_USER | SAIC user name - **required** | | -p or --saic-password | SAIC_PASSWORD | SAIC password - **required** | | --saic-phone-country-code | SAIC_PHONE_COUNTRY_CODE | Phone country code, used if the username is not an email address | -| --saic-preset | SAIC_PRESET | Preset for the SAIC API: mg_eu (default), mg_au, mg_tr or maxus_eu. Sets the URI, region, tenant ID and app ID. The options below override single values. | +| --saic-preset | SAIC_PRESET | Preset for the SAIC API: mg_eu (default), mg_au, mg_tr, mg_br or maxus_eu. Sets the URI, region, tenant ID and app ID. The options below override single values. | | --saic-rest-uri | SAIC_REST_URI | SAIC API URI. Default comes from the preset (mg_eu: https://gateway-mg-eu.soimt.com/api.app/v1/) | | --saic-region | SAIC_REGION | SAIC API region. Default comes from the preset. | | --saic-tenant-id | SAIC_TENANT_ID | SAIC API tenant ID. Default comes from the preset (459771 for MG, 590224 for MAXUS). | @@ -57,7 +57,7 @@ The following are the known available endpoints: | https://gateway-mg-au.soimt.com/api.app/v1/ | au | This endpoint is not used by the iSmart app for Australia and New Zealand but has been tested and proven to work in these countries. | | https://gateway-mg-eu.soimt.com/api.app/v1/ | eu | | | https://gateway-mg-tr.soimt.com/api.app/v1/ | tr | This endpoint is valid for the country of Türkiye. | -| https://gateway-mg-br.soimt.com/api.app/v1/ | br | Used by the "MG i-SMART LATAM" app (Brazil). Tested with the default tenant ID and a secondary account on an MG4 Urban. | +| https://gateway-mg-br.soimt.com/api.app/v1/ | br | Used by the "MG i-SMART LATAM" app (Brazil). Use SAIC_PRESET=mg_br. | | https://gateway-maxus-eu.soimt.com/api.app/v1/ | eu | MAXUS Europe app. Use SAIC_PRESET=maxus_eu. Values confirmed by capture. | ### MQTT Broker diff --git a/poetry.lock b/poetry.lock index 2255282..fa08c43 100644 --- a/poetry.lock +++ b/poetry.lock @@ -1214,14 +1214,14 @@ files = [ [[package]] name = "saic-ismart-client-ng" -version = "0.15.0" +version = "0.16.0" description = "SAIC next gen client library (MG iSMART)" optional = false python-versions = ">=3.12" groups = ["main"] files = [ - {file = "saic_ismart_client_ng-0.15.0-py3-none-any.whl", hash = "sha256:079f8045d2d58123e68958653d051543e040531882f46385225a8d8457bac7ba"}, - {file = "saic_ismart_client_ng-0.15.0.tar.gz", hash = "sha256:f7546400bd111a3237c50faf0db2dc2decd2b7d42a5c163840b2d0a82c06ee20"}, + {file = "saic_ismart_client_ng-0.16.0-py3-none-any.whl", hash = "sha256:082b5cb730b81f0a1dd8debe9a6dee4bd75c45ef159076bd653671d47cea9f48"}, + {file = "saic_ismart_client_ng-0.16.0.tar.gz", hash = "sha256:080c775dbb618a9fd196f5f630b235dc807e21faee6b002694be2de2bc502c11"}, ] [package.dependencies] @@ -1325,4 +1325,4 @@ python-discovery = ">=1.6.1" [metadata] lock-version = "2.1" python-versions = ">=3.12,<4.0" -content-hash = "365cdd33aee72b960c196c30a9d05e29c735506bf0b518c3859680e999b02023" +content-hash = "767472d6aca17377f4a0bde7403a3257c4576252abbd816d95337d264e7902ec" diff --git a/pyproject.toml b/pyproject.toml index f14f7ca..3766a5c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -15,7 +15,7 @@ classifiers = [ requires-python = '>=3.12,<4.0' dependencies = [ - "saic-ismart-client-ng (>=0.15.0,<0.16.0)", + "saic-ismart-client-ng (>=0.16.0,<0.17.0)", 'httpx (>=0.28.1,<0.29.0)', 'inflection (>=0.5.1,<0.6.0)', 'apscheduler (>=3.11.0,<4.0.0)', diff --git a/src/configuration/parser.py b/src/configuration/parser.py index f33e9ea..dbdee00 100644 --- a/src/configuration/parser.py +++ b/src/configuration/parser.py @@ -331,9 +331,9 @@ def __add_saic_api_argument_group( ) saic_api.add_argument( "--saic-preset", - help="""The SAIC API preset: mg_eu, mg_au, mg_tr or maxus_eu.""", + help="""The SAIC API preset: mg_eu, mg_au, mg_tr, mg_br or maxus_eu.""", default="mg_eu", - choices=["mg_eu", "mg_au", "mg_tr", "maxus_eu"], + choices=["mg_eu", "mg_au", "mg_tr", "mg_br", "maxus_eu"], dest="saic_preset", required=False, action=EnvDefault, diff --git a/tests/test_parser.py b/tests/test_parser.py index a03278a..7ee4119 100644 --- a/tests/test_parser.py +++ b/tests/test_parser.py @@ -114,6 +114,25 @@ def test_process_command_line_sets_preset( assert config.saic_rest_uri is None +def test_process_command_line_accepts_mg_br_preset( + monkeypatch: pytest.MonkeyPatch, +) -> None: + monkeypatch.setattr( + "sys.argv", + [ + "prog", + "--saic-user", + "user@example.com", + "--saic-password", + "secret", + "--saic-preset", + "mg_br", + ], + ) + config = process_command_line() + assert config.saic_preset == "mg_br" + + def test_process_command_line_rejects_unknown_preset( monkeypatch: pytest.MonkeyPatch, ) -> None: