Skip to content

Hyundai Bluelink: add Australia and New Zealand regions#30037

Draft
aldasilva0 wants to merge 4 commits into
evcc-io:masterfrom
aldasilva0:feat/bluelink-au-region
Draft

Hyundai Bluelink: add Australia and New Zealand regions#30037
aldasilva0 wants to merge 4 commits into
evcc-io:masterfrom
aldasilva0:feat/bluelink-au-region

Conversation

@aldasilva0
Copy link
Copy Markdown

@aldasilva0 aldasilva0 commented May 20, 2026

Problem

Australian Hyundai Bluelink users receive a 400 Bad Request regardless
of credentials because their accounts are on a different backend
(au-apigw.ccs.hyundai.com.au:8080) with a different auth flow than the
EU API. There is no way to configure the region in the current template.

Solution

  • Adds a region parameter to the hyundai template (defaults to
    Europe — fully backward compatible, no existing configs break)
  • AU/NZ uses Authorization: Basic header auth instead of
    client_id/client_secret in the request body
  • AU/NZ uses /api/v1/user/oauth2/token instead of the EU token path
  • API constants sourced from the hyundai_kia_connect_api library
    (KiaUvoApiAU.py), the same library used by the Home Assistant
    Kia/Hyundai integration which already supports AU

Testing

Tested with Hyundai Kona, Australian Bluelink account, region: Australia.
Successfully retrieves SoC via evcc vehicle command.

Relates to

Revives stale PR #22760, fix #29987

- Add region parameter to hyundai template (defaults to Europe)
- Add AU/NZ config constants to vehicle/bluelink.go
- Add TokenURL, UseBasicAuth, and APIHost fields to bluelink.Config
- AU region uses Basic auth header instead of client_id/secret in body
- AU region uses /api/v1/user/oauth2/token instead of EU token path
- Tested with Hyundai Kona, Australian Bluelink account

Revives stale PR evcc-io#22760
Copy link
Copy Markdown
Contributor

@sourcery-ai sourcery-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've found 2 issues, and left some high level feedback:

  • The AU-specific constants added in identity.go (HyundaiAUBaseURI, HyundaiAUCCSPServiceID, etc.) are currently unused and duplicate values defined in bluelink.go; consider removing them or wiring everything through a single source of truth to avoid drift.
  • The AU CCSPServiceSecret string in NewHyundaiFromConfig contains a space (...pviaP p3rf4t3S6k9...), which likely breaks the credential and should be verified and corrected.
  • There are a few formatting inconsistencies introduced (tabs vs spaces and misaligned struct fields like APIHost in the AU config); cleaning these up will keep the codebase style consistent.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- The AU-specific constants added in identity.go (HyundaiAUBaseURI, HyundaiAUCCSPServiceID, etc.) are currently unused and duplicate values defined in bluelink.go; consider removing them or wiring everything through a single source of truth to avoid drift.
- The AU CCSPServiceSecret string in NewHyundaiFromConfig contains a space (`...pviaP p3rf4t3S6k9...`), which likely breaks the credential and should be verified and corrected.
- There are a few formatting inconsistencies introduced (tabs vs spaces and misaligned struct fields like APIHost in the AU config); cleaning these up will keep the codebase style consistent.

## Individual Comments

### Comment 1
<location path="vehicle/bluelink.go" line_range="42-51" />
<code_context>
+			Brand:             "hyundai",
+		}
+	case "Australia", "New Zealand":
+		settings = bluelink.Config{
+			URI:               "https://au-apigw.ccs.hyundai.com.au:8080",
+			CCSPServiceID:     "855c72df-dfd7-4230-ab03-67cbf902bb1c",
+			CCSPServiceSecret: "e6fbwHM32YNbhQl0pviaP p3rf4t3S6k91eceA3MJLdbdThCO",
+			CCSPApplicationID: "f9ccfdac-a48d-4c57-bd32-9116963c24ed",
+			Cfb:               "nGDHng3k4Cg9gWV+C+A6Yk/ecDopUNTkGmDpr2qVKAQXx9bvY2/YLoHPfObliK32mZQ=",
</code_context>
<issue_to_address>
**issue (bug_risk):** The AU CCSPServiceSecret contains an embedded space, which is likely to break authentication.

The AU/NZ `CCSPServiceSecret` includes an internal space:

```go
CCSPServiceSecret: "e6fbwHM32YNbhQl0pviaP p3rf4t3S6k91eceA3MJLdbdThCO",
```
Please confirm this matches the exact production secret. If not intentional, remove the space so token requests for AU/NZ don’t fail.
</issue_to_address>

### Comment 2
<location path="vehicle/bluelink/identity.go" line_range="29-34" />
<code_context>
 	LanguageURL        = "/api/v1/user/language"
 	LoginURL           = "/api/v1/user/signin"
 	TokenURL           = "/auth/api/v2/user/oauth2/token"
+	// AU region constants (sourced from hyundai_kia_connect_api KiaUvoApiAU.py)
+    HyundaiAUBaseURI          = "https://au-apigw.ccs.hyundai.com.au:8080"
+    HyundaiAUCCSPServiceID    = "855c72df-dfd7-4230-ab03-67cbf902bb1c"
+    HyundaiAUCCSPAppID        = "f9ccfdac-a48d-4c57-bd32-9116963c24ed"
+    HyundaiAUBasicToken       = "Basic ODU1YzcyZGYtZGZkNy00MjMwLWFiMDMtNjdjYmY5MDJiYjFjOmU2ZmJ3SE0zMllOYmhRbDBwdmlhUHAzcmY0dDNTNms5MWVjZUEzTUpMZGJkVGhDTw=="
+    HyundaiAUCfb              = "nGDHng3k4Cg9gWV+C+A6Yk/ecDopUNTkGmDpr2qVKAQXx9bvY2/YLoHPfObliK32mZQ="
 )

</code_context>
<issue_to_address>
**suggestion:** AU configuration values are duplicated here and in NewHyundaiFromConfig, which may lead to divergence.

These AU constants (base URI, service ID, app ID, basic token, CFB) are also hard-coded in `NewHyundaiFromConfig`, which creates a risk of them getting out of sync. Please centralize the AU configuration (e.g., via these constants or a shared helper) and have `NewHyundaiFromConfig` reuse that single source.

Suggested implementation:

```golang
	LanguageURL        = "/api/v1/user/language"
	LoginURL           = "/api/v1/user/signin"
	TokenURL           = "/auth/api/v2/user/oauth2/token"

	// AU region constants (sourced from hyundai_kia_connect_api KiaUvoApiAU.py)
	// Centralized here so NewHyundaiFromConfig and any other AU users share a single source.
	HyundaiAUBaseURI       = "https://au-apigw.ccs.hyundai.com.au:8080"
	HyundaiAUCCSPServiceID = "855c72df-dfd7-4230-ab03-67cbf902bb1c"
	HyundaiAUCCSPAppID     = "f9ccfdac-a48d-4c57-bd32-9116963c24ed"
	HyundaiAUBasicToken    = "Basic ODU1YzcyZGYtZGZkNy00MjMwLWFiMDMtNjdjYmY5MDJiYjFjOmU2ZmJ3SE0zMllOYmhRbDBwdmlhUHAzcmY0dDNTNms5MWVjZUEzTUpMZGJkVGhDTw=="
	HyundaiAUCfb           = "nGDHng3k4Cg9gWV+C+A6Yk/ecDopUNTkGmDpr2qVKAQXx9bvY2/YLoHPfObliK32mZQ="
)

```

```golang
// Config is the bluelink API configuration
	Cfb           string
	LoginFormHost string
	Brand         string
	TokenURL      string
	APIHost       string // used as Host header for AU-style APIs
	UseBasicAuth  bool
}

```

To fully centralize the AU configuration and avoid divergence:

1. In `NewHyundaiFromConfig` (and any other AU-specific initialization logic in `identity.go`), replace any hard-coded AU literals with references to these constants:
   - `"https://au-apigw.ccs.hyundai.com.au:8080"``HyundaiAUBaseURI`
   - `"855c72df-dfd7-4230-ab03-67cbf902bb1c"``HyundaiAUCCSPServiceID`
   - `"f9ccfdac-a48d-4c57-bd32-9116963c24ed"``HyundaiAUCCSPAppID`
   - `"Basic ODU1YzcyZGYtZGZkNy00MjMwLWFiMDMtNjdjYmY5MDJiYjFjOmU2ZmJ3SE0zMllOYmhRbDBwdmlhUHAzcmY0dDNTNms5MWVjZUEzTUpMZGJkVGhDTw=="``HyundaiAUBasicToken`
   - `"nGDHng3k4Cg9gWV+C+A6Yk/ecDopUNTkGmDpr2qVKAQXx9bvY2/YLoHPfObliK32mZQ="``HyundaiAUCfb`

2. If `NewHyundaiFromConfig` currently sets `APIHost`, `Cfb`, `UseBasicAuth`, etc. based on region with AU literals, update those assignments to use the corresponding constants above.

3. If there are unit tests that assert on the literal AU values, update them to assert against the constants, or at least derive their expectations from these constants to keep a single source of truth.
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Comment thread vehicle/bluelink.go
Comment on lines +42 to +51
settings = bluelink.Config{
URI: "https://prd.eu-ccapi.hyundai.com:8080",
CCSPServiceID: "6d477c38-3ca4-4cf3-9557-2a1929a94654",
CCSPServiceSecret: "KUy49XxPzLpLuoK0xhBC77W6VXhmtQR9iQhmIFjjoY4IpxsV",
CCSPApplicationID: "014d2225-8495-4735-812d-2616334fd15d",
Cfb: "RFtoRq/vDXJmRndoZaZQyfOot7OrIqGVFj96iY2WL3yyH5Z/pUvlUhqmCxD2t+D65SQ=",
BasicToken: "NmQ0NzdjMzgtM2NhNC00Y2YzLTk1NTctMmExOTI5YTk0NjU0OktVeTQ5WHhQekxwTHVvSzB4aEJDNzdXNlZYaG10UVI5aVFobUlGampvWTRJcHhzVg==",
PushType: "GCM",
LoginFormHost: "https://idpconnect-eu.hyundai.com",
Brand: "hyundai",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue (bug_risk): The AU CCSPServiceSecret contains an embedded space, which is likely to break authentication.

The AU/NZ CCSPServiceSecret includes an internal space:

CCSPServiceSecret: "e6fbwHM32YNbhQl0pviaP p3rf4t3S6k91eceA3MJLdbdThCO",

Please confirm this matches the exact production secret. If not intentional, remove the space so token requests for AU/NZ don’t fail.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment thread vehicle/bluelink/identity.go Outdated
Comment on lines +29 to +34
// AU region constants (sourced from hyundai_kia_connect_api KiaUvoApiAU.py)
HyundaiAUBaseURI = "https://au-apigw.ccs.hyundai.com.au:8080"
HyundaiAUCCSPServiceID = "855c72df-dfd7-4230-ab03-67cbf902bb1c"
HyundaiAUCCSPAppID = "f9ccfdac-a48d-4c57-bd32-9116963c24ed"
HyundaiAUBasicToken = "Basic ODU1YzcyZGYtZGZkNy00MjMwLWFiMDMtNjdjYmY5MDJiYjFjOmU2ZmJ3SE0zMllOYmhRbDBwdmlhUHAzcmY0dDNTNms5MWVjZUEzTUpMZGJkVGhDTw=="
HyundaiAUCfb = "nGDHng3k4Cg9gWV+C+A6Yk/ecDopUNTkGmDpr2qVKAQXx9bvY2/YLoHPfObliK32mZQ="
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion: AU configuration values are duplicated here and in NewHyundaiFromConfig, which may lead to divergence.

These AU constants (base URI, service ID, app ID, basic token, CFB) are also hard-coded in NewHyundaiFromConfig, which creates a risk of them getting out of sync. Please centralize the AU configuration (e.g., via these constants or a shared helper) and have NewHyundaiFromConfig reuse that single source.

Suggested implementation:

	LanguageURL        = "/api/v1/user/language"
	LoginURL           = "/api/v1/user/signin"
	TokenURL           = "/auth/api/v2/user/oauth2/token"

	// AU region constants (sourced from hyundai_kia_connect_api KiaUvoApiAU.py)
	// Centralized here so NewHyundaiFromConfig and any other AU users share a single source.
	HyundaiAUBaseURI       = "https://au-apigw.ccs.hyundai.com.au:8080"
	HyundaiAUCCSPServiceID = "855c72df-dfd7-4230-ab03-67cbf902bb1c"
	HyundaiAUCCSPAppID     = "f9ccfdac-a48d-4c57-bd32-9116963c24ed"
	HyundaiAUBasicToken    = "Basic ODU1YzcyZGYtZGZkNy00MjMwLWFiMDMtNjdjYmY5MDJiYjFjOmU2ZmJ3SE0zMllOYmhRbDBwdmlhUHAzcmY0dDNTNms5MWVjZUEzTUpMZGJkVGhDTw=="
	HyundaiAUCfb           = "nGDHng3k4Cg9gWV+C+A6Yk/ecDopUNTkGmDpr2qVKAQXx9bvY2/YLoHPfObliK32mZQ="
)
// Config is the bluelink API configuration
	Cfb           string
	LoginFormHost string
	Brand         string
	TokenURL      string
	APIHost       string // used as Host header for AU-style APIs
	UseBasicAuth  bool
}

To fully centralize the AU configuration and avoid divergence:

  1. In NewHyundaiFromConfig (and any other AU-specific initialization logic in identity.go), replace any hard-coded AU literals with references to these constants:

    • "https://au-apigw.ccs.hyundai.com.au:8080"HyundaiAUBaseURI
    • "855c72df-dfd7-4230-ab03-67cbf902bb1c"HyundaiAUCCSPServiceID
    • "f9ccfdac-a48d-4c57-bd32-9116963c24ed"HyundaiAUCCSPAppID
    • "Basic ODU1YzcyZGYtZGZkNy00MjMwLWFiMDMtNjdjYmY5MDJiYjFjOmU2ZmJ3SE0zMllOYmhRbDBwdmlhUHAzcmY0dDNTNms5MWVjZUEzTUpMZGJkVGhDTw=="HyundaiAUBasicToken
    • "nGDHng3k4Cg9gWV+C+A6Yk/ecDopUNTkGmDpr2qVKAQXx9bvY2/YLoHPfObliK32mZQ="HyundaiAUCfb
  2. If NewHyundaiFromConfig currently sets APIHost, Cfb, UseBasicAuth, etc. based on region with AU literals, update those assignments to use the corresponding constants above.

  3. If there are unit tests that assert on the literal AU values, update them to assert against the constants, or at least derive their expectations from these constants to keep a single source of truth.

@andig andig marked this pull request as draft May 20, 2026 09:15
Comment thread vehicle/bluelink.go Outdated
@andig andig added the vehicles Specific vehicle support label May 20, 2026
@andig andig changed the title feat: add Australia and New Zealand region support for Hyundai Bluelink Hyundai Bluelink: add Australia and New Zealand regions May 20, 2026
Comment thread vehicle/bluelink.go Outdated
Comment thread vehicle/bluelink.go
LoginFormHost: "https://au-apigw.ccs.hyundai.com.au:8080",
TokenURL: "/api/v1/user/oauth2/token",
Brand: "hyundai",
APIHost: "au-apigw.ccs.hyundai.com.au:8080",
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the APIHost really needed?

@andig
Copy link
Copy Markdown
Member

andig commented May 24, 2026

ping @aldasilva0 pls check if you want to finish this ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

vehicles Specific vehicle support

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add Hyundai Australia Support

2 participants