Skip to content

Add EMEA charge-schedule support (read from v3 status, write via v2 CPPLUS) - #13

Open
815rx1 wants to merge 2 commits into
hass-uconnect:masterfrom
815rx1:emea-charge-schedules
Open

Add EMEA charge-schedule support (read from v3 status, write via v2 CPPLUS)#13
815rx1 wants to merge 2 commits into
hass-uconnect:masterfrom
815rx1:emea-charge-schedules

Conversation

@815rx1

@815rx1 815rx1 commented Jul 8, 2026

Copy link
Copy Markdown

Summary

EMEA EVs such as the Fiat New 500e do not use the North-American
/v4/accounts/{uid}/vehicles/{vin}/ev/schedule/ endpoint. That endpoint
returns HTTP 500 for these cars. Instead:

  • Read: the (up to three) charge schedules are already present inline in
    the v3 vehicle status under evInfo.schedules. No extra request is needed.
  • Write: schedules are set with a POST /v2/.../ev/schedule/ carrying a
    CPPLUS command envelope ({command, pinAuth, schedules[]}).

This PR adds a typed representation of those schedules to Vehicle, parses
them from the v3 status, and adds read-modify-write support via a new
Client.set_charge_schedule_emea() / API.set_charge_schedule_emea().

Everything is additive - no existing behaviour changes, the NA
set_charge_schedule (v4) path is untouched.

Confirmed working

Verified live against a 2022 Fiat New 500e (soldRegion=EMEA, sdp=IGNITE,
market=DE, service CPPLUS serviceEnabled=true):

GET  /v4/.../ev/schedule/  -> HTTP 500 Internal Server Error   (NA endpoint, unusable)
POST /v2/.../ev/schedule/  -> HTTP 200
     {"command":"CPPLUS","correlationId":"...","responseStatus":"pending","asyncRespTimeout":2}

Setting slot 1 to "Mon-Fri 01:00-05:00" was reflected both in the subsequent
v3 status read and in the official Fiat app; disabling it again worked the
same way. ChargeSchedule.to_api() reproduces the confirmed 200 payload
byte-for-byte (verified in a unit test against the real status payload).

Fixes the read/write gap reported downstream in hass-uconnect#110
(Fiat 500e EU/EMEA schedule charging).

Changes

client.py

  • New @dataclass_json classes ScheduledDays and ChargeSchedule with
    from_api() / to_api() converters (API <-> snake_case).
  • New field Vehicle.charge_schedules: list[ChargeSchedule].
  • _update_vehicle() now parses evInfo.schedules into that field.
  • Client.set_charge_schedule_emea(vin, schedules, verify=False) - takes the
    full slot list, serialises, POSTs, optionally polls the correlation id.
  • CHARGING_LEVELS extended with LEVEL_4/LEVEL_5 and the EMEA word-form
    keys LEVEL_ONE..LEVEL_FIVE.
  • charging_level_preference is now mapped through CHARGING_LEVELS to an
    int (1..5) instead of being left as the raw string, matching the README
    example ("charging_level_preference": 5) and charging_level. Type hint
    changed str -> int.

api.py

  • API.set_charge_schedule_emea(vin, schedules) - the
    POST /v2/.../ev/schedule/ with the CPPLUS envelope. Raises on missing
    correlationId, mirroring the existing set_charge_schedule.

Important behavioural note (documented in the docstring)

The backend replaces the entire schedule list on every write. Sending a
single slot silently resets the others to defaults. Callers must therefore
read vehicle.charge_schedules, modify the slot(s) they need, and pass the
whole list back - set_charge_schedule_emea is designed around exactly this
read-modify-write pattern.

Possible breaking change to flag for the maintainer

charging_level_preference changes type from str ("LEVEL_FIVE") to
int (5). This matches the documented README output and charging_level,
but any downstream consumer comparing the raw string would need updating.
Happy to keep it as a string if you prefer - just say the word.

Not included / out of scope

  • Trip history: on this vehicle ECOCOACHING20/TRIPREPORT are
    serviceEnabled=false, the eco-coaching endpoints return nothing usable.
  • Auto-detecting NA vs EMEA: left to the caller for now (the two write paths
    coexist). A follow-up could switch on soldRegion.

815rx1 added 2 commits July 8, 2026 21:46
Updated charge level preference to use integers and added support for EMEA charge schedules.
Introduced a new method to set EV charge schedules specifically for EMEA vehicles, addressing issues with the existing method and ensuring compatibility with EMEA models.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant