Services
The integration exposes global xpeng.* services and native entity services. Every vehicle service accepts an optional vehicle_entity_id — any entity of the car you mean — so a command can be aimed at a particular vehicle on an install with several; see Choosing the vehicle. Prefer native cover, climate, switch, number, select and lock actions with an explicit entity target when controlling a particular vehicle.
The four HVAC schedule services accept vehicle_entity_id (a climate entity, tracker or other XPENG entity). It is required when more than one vehicle is configured. The selected entry's policy and the caller's entity permissions are checked. xpeng.import_credentials instead accepts a config entry_id.
Climate, window open/vent/close, charging start/stop, charge-port, charge-limit and defrost command paths wait for a correlated acknowledgement and raise for refusals, malformed responses and timeouts. Other legacy MQTT services return after publication; REST calls return their API result. Acknowledgement is not proof of physical actuation: measured telemetry supplies the state. Replies without a matching ID or echoed command identity cannot confirm a request.
INFO
Selectors describe the broad UI input range. Runtime validation also checks vehicle capability. Climate normally uses 16–32 °C; the 15.5/32.5 LO/HI endpoints are accepted only when the vehicle advertises them. Changing a target alone does not power on A/C. climate_on first sets its target, then requests power; if the second step fails, its error states that the target may already be changed.
Every service is registered when the first config entry is set up, and every one is removed again when the last entry is unloaded.
Calling services
From an automation or script, use an action:
- alias: Cabin pre-condition before the school run
triggers:
- trigger: time
at: "07:20:00"
conditions:
- condition: state
entity_id: binary_sensor.xpeng_<vehicle>_charging
state: "off"
actions:
- action: xpeng.climate_on
data:
temperature: 21.5
duration: 20From a shell or an external tool, call the REST API with a long-lived token:
curl -sS -X POST \
-H "Authorization: Bearer $HA_TOKEN" \
-H "Content-Type: application/json" \
-d '{"temperature": 21.5, "duration": 20}' \
http://your-ha-host:8123/api/services/xpeng/climate_onrest_command works the same way and is how the renewal app is driven from an automation; see Credential import and Unattended renewal.
Every service below belongs to a capability group, and is refused unless that group is at Full access - a ceiling that applies to automations, scripts, voice assistants and tokens alike. xpeng.import_credentials is the one exemption. See Command permissions for the groups and for what a refusal looks like.
Choosing the vehicle
On an install with more than one XPENG vehicle, every service below takes an optional vehicle_entity_id: any entity of the car you mean (lock.…, device_tracker.…, climate.…). The call is dispatched to that car's config entry, and the caller's entity permissions are checked against that same entry.
- action: xpeng.send_navigation
data:
vehicle_entity_id: device_tracker.xpeng_x9_location
name: School
latitude: 51.7520
longitude: -1.2577Omitting it keeps the older behaviour - the first configured entry - and logs one warning per setup when several vehicles exist. The four HVAC schedule services are stricter, because there "no target" is genuinely ambiguous: they refuse a multi-car call that names no vehicle. See Selecting the vehicle for schedules.
Climate and comfort
climate_on
Turns the cabin climate control on and schedules it to stop, so it cannot be left running indefinitely.
| Field | Required | Default | Description |
|---|---|---|---|
temperature | no | 22.0 | Target temperature in °C; 15.5–32.5, step 0.5; endpoints require vehicle support |
duration | no | 15 | Run time in minutes; 1–60 |
service: xpeng.climate_on
data:
temperature: 21.5
duration: 20climate_off
Turns climate control off. No fields.
service: xpeng.climate_offdefrost_on
Turns on front-windscreen defrost. No fields.
defrost_off
Turns off front-windscreen defrost. No fields.
service: xpeng.defrost_onWindows, doors and body
| Service | Effect |
|---|---|
close_windows | Official app close command (service 12, cmd_type 1, value 1). Physically confirmed on a P7+ (22 October 2026) |
vent_windows | Vents all windows. This is the only window command verified to work, and the name is the accurate one |
open_windows | Also sends the verified command above, which vents — full opening was not observed |
open_trunk | Opens the vehicle trunk |
close_trunk | Closes the vehicle trunk |
lock | Locks the doors |
unlock | Unlocks the doors |
None of these takes a field. They are the same commands the corresponding button and lock entities issue; lock is worth preferring for the door lock, because it reports the state back.
Window opening/ventilation uses service 12, cmd_type 1, value 2. Closing uses value 1 from the official Android handler. The old charge-port payloads are not window commands. A P7+ owner physically confirmed ventilation and closing on 22 October 2026; full opening has not been verified.
service: xpeng.vent_windowsservice: xpeng.open_trunkCharging
start_charge
Starts a charge on whichever connector is plugged in. No fields.
stop_charge
Stops an in-progress charge. No fields.
service: xpeng.start_chargeset_charge_limit
Sets the battery charge limit — the percentage at which the car stops charging.
| Field | Required | Default | Description |
|---|---|---|---|
limit | yes | – | Target charge percentage; 50–100, step 5 |
service: xpeng.set_charge_limit
data:
limit: 80set_charge_current
Sets the AC charge current limit in amperes — the car-side equivalent of turning the wallbox down, for matching a solar or load-limited supply. It applies to a session that is already running, not only the next one.
| Field | Required | Default | Description |
|---|---|---|---|
current | yes | – | Target AC current; 6–32, step 1 |
service: xpeng.set_charge_current
data:
current: 10
vehicle_entity_id: sensor.my_g6_batteryThis is not set_charge_limit, which takes a battery percentage: same service type, different cmd_type, different unit. The 6-32 A range maps to the official app's 1-27 wire index: the integration sends current - 5 and converts the reported index back to amperes. This fixes the previous five-amp mismatch: selecting 20 A used to send index 20, which the app displayed as 25 A. A code 200 means the request was accepted; read sensor.<car>_charge_current_limit back after fresh telemetry to confirm the result. If an automation compensated for the old offset, remove that workaround.
The same command is exposed as number.<car>_charge_current_limit_control, which is what a dashboard or a number.set_value automation should use.
open_charge_port / close_charge_port
Open and close the charge-port flap. No fields. Export cars have one combined CCS2 port, so this is the only port command: the car refuses the fast-port variant (cmd_type 4) with 10404 / 10405, and the integration no longer offers it.
Both services raise a clear error when Motorized charge-port controls is turned off in the options — the setting for a car with a manual flap, which cannot act on these commands. The charge-port state sensor keeps reporting either way.
service: xpeng.open_charge_porttrunk_power_on
Enables the trunk power outlet (V2L) with an auto-off timer.
| Field | Required | Default | Description |
|---|---|---|---|
duration | no | 60 | Auto-off timer in minutes; 1–1440 |
service: xpeng.trunk_power_on
data:
duration: 120trunk_power_off
Disables the trunk power outlet. No fields.
The auto-off timer is what stops the outlet if nothing else does, so set it to something short unless the load needs longer.
Security and sentinel
sentinel_on
Enables sentinel (sentry) mode.
| Field | Required | Default | Description |
|---|---|---|---|
sensitivity | no | 2 | Detection sensitivity level; 0–3 |
service: xpeng.sentinel_on
data:
sensitivity: 2sentinel_off
Disables sentinel mode. No fields.
Sentinel mode is the vehicle's own parked-surveillance feature, and binary_sensor.xpeng_<vehicle>_sentinel_mode reports whether it is armed — see Entities.
Lights and horn
flash_lights
Flashes the vehicle lights. No fields.
honk_horn
Sounds the vehicle horn. No fields.
service: xpeng.flash_lightsThese are the two commands worth putting behind a confirmation or a presence condition — both are audible and visible from outside the car.
X-Combo scenes
Both services act on the account's X-Combo smart scenes, which live in the cloud rather than on the vehicle. The scene ids come from the X-Combo entities and attributes (see Entities).
execute_scene
Executes (one-key start) a scene.
| Field | Required | Default | Description |
|---|---|---|---|
scene_id | yes | – | The X-Combo scene id, as a string |
service: xpeng.execute_scene
data:
scene_id: "12345"toggle_scene
Activates or deactivates a scene.
| Field | Required | Default | Description |
|---|---|---|---|
scene_id | yes | – | The X-Combo scene id, as a string |
active | yes | – | true to activate, false to deactivate |
service: xpeng.toggle_scene
data:
scene_id: "12345"
active: trueBoth need working app-tier credentials; with file-based tokens and no API access they log an error and do nothing.
OTA and software
check_ota
Asks the cloud for available OTA updates and refreshes the OTA sensor data. No fields. Useful after a release announcement, rather than waiting for the next scheduled check.
trigger_ota
Starts an OTA upgrade on the vehicle.
| Field | Required | Default | Description |
|---|---|---|---|
upgrade_id | yes | – | Upgrade id from the OTA upgrade sensor's attributes; integer ≥ 1 |
service: xpeng.trigger_ota
data:
upgrade_id: 12345WARNING
This installs software on the car. Read the upgrade id from the OTA sensor attributes, make sure the car is parked and has charge, and do not run it in a loop.
cancel_ota
Cancels a scheduled OTA upgrade.
| Field | Required | Default | Description |
|---|---|---|---|
upgrade_id | yes | – | Upgrade id of the scheduled update; integer ≥ 1 |
auto_upgrade_on
Enables automatic OTA upgrades. No fields.
auto_upgrade_off
Disables automatic OTA upgrades. No fields.
ota_feedback
Sends OTA upgrade status feedback to the server — this is what the head unit normally reports.
| Field | Required | Default | Description |
|---|---|---|---|
upgrade_id | yes | – | Upgrade id to report on; integer ≥ 1 |
status | yes | 0 (as documented) | Status code; 0 is success, integer ≥ 0 |
The field declares both required: true and a default of 0, which is contradictory: the code schema requires status, so supply it explicitly.
service: xpeng.ota_feedback
data:
upgrade_id: 12345
status: 0Navigation and calendar
send_navigation
Sends a destination card to the vehicle's head unit — the cloud equivalent of the official app's "send POI to car" feature.
| Field | Required | Default | Description |
|---|---|---|---|
name | yes | – | Destination name shown on the vehicle screen |
latitude | yes | – | Destination latitude, WGS84; -90–90 |
longitude | yes | – | Destination longitude, WGS84; -180–180 |
label | no | – | Optional category label for the card |
poi_id | no | – | Optional POI id from a POI search |
msg_type | no | – | Optional message type sent to the server; omit to leave it out |
service: xpeng.send_navigation
data:
name: Home
latitude: 51.5074
longitude: -0.1278
label: HomeUsing it as an announcement
The card is a destination, not a route: the head unit shows it, and nothing is routed until somebody taps Navigate, so dismissing it with X turns the service into a one-way announcement channel. Put the message in name, keep label short, and point the coordinates somewhere harmless — home is a good choice — so an accidental tap cannot send the car elsewhere.
- alias: Garage door announcement on the car screen
id: garage_door_announcement
triggers:
- trigger: state
entity_id: cover.garage_door
to: open
id: opened
- trigger: state
entity_id: cover.garage_door
to: closed
id: closed
actions:
- action: xpeng.send_navigation
continue_on_error: true
data:
vehicle_entity_id: device_tracker.xpeng_<vehicle>_location
name: "Garage Door {{ 'Open' if trigger.id == 'opened' else 'Close' }}"
label: Home
latitude: "{{ state_attr('zone.home', 'latitude') }}"
longitude: "{{ state_attr('zone.home', 'longitude') }}"continue_on_error: true is deliberate: the call is a cloud round-trip, and an expired session or an unreachable car must not stop the actions that follow it.
Because send_navigation belongs to the Queries and data group, every permission preset leaves it callable — including Read only. If no card appears, check that Send Address to Vehicle is on in the car's settings and that the model supports address sharing.
force_calendar_sync
Triggers the vehicle's phone-calendar schedule sync — the same action as the sync button on the head unit. It re-asserts the calendar sync authorisation and refreshes the schedule metadata from the XPENG assistant service. No fields.
create_hvac_schedule
Creates a scheduled HVAC (climate) appointment on the vehicle. An empty days_of_week means a one-shot appointment at the next occurrence.
| Field | Required | Default | Description |
|---|---|---|---|
start_time | yes | – | Local start time, HH:MM (24 h) |
days_of_week | no | [] | Weekday numbers 1=Mon…7=Sun for a recurring schedule; empty = one-shot |
enabled | no | true | Whether the schedule starts active |
action_type | no | AIR_CONDITION_OPEN | Backend actionType string (advanced) |
time_zone | no | – | Optional IANA time zone, e.g. Europe/London |
service: xpeng.create_hvac_schedule
data:
start_time: "07:30"
days_of_week: [1, 2, 3, 4, 5]
enabled: trueupdate_hvac_schedule
Updates an existing appointment by id. Same fields as create_hvac_schedule, plus the id of the appointment to change.
| Field | Required | Default | Description |
|---|---|---|---|
appointment_id | yes | – | appointmentId returned by create/list |
start_time | yes | – | Local start time, HH:MM (24 h) |
days_of_week | no | [] | Weekday numbers 1–7; empty = one-shot |
enabled | no | true | Whether the schedule is active |
action_type | no | AIR_CONDITION_OPEN | Backend actionType string (advanced) |
time_zone | no | – | Optional IANA time zone |
service: xpeng.update_hvac_schedule
data:
appointment_id: "<appointment-id>"
start_time: "08:00"
days_of_week: [1, 2, 3, 4, 5]delete_hvac_schedule
Deletes an appointment by id.
| Field | Required | Default | Description |
|---|---|---|---|
appointment_id | yes | – | appointmentId returned by create/list |
time_zone | no | – | Optional IANA time zone |
service: xpeng.delete_hvac_schedule
data:
appointment_id: "<appointment-id>"list_hvac_schedules
Fetches the current list of HVAC appointments and logs it — the response is written to the Home Assistant log (search for HVAC schedules) rather than returned, so it is not a service to call from an automation that needs the data. No fields. The calendar entity and the per-appointment switches are the entity view of the same list.
Diagnostics and maintenance
force_update
Forces a vehicle state update query. No fields.
It is a passive query (msg_type: 4), not a force-upload: a sleeping car answers it with a stub without waking. The commands that do wake a car are the active-state force-uploads and the watchdog escalation, not this service, so it is safe to call when a value looks stale.
service: xpeng.force_updatecapture_snapshot
Writes a JSON snapshot of every coordinator-tracked field to <config>/xpeng_snapshots/<vin>_<timestamp>.json.
| Field | Required | Default | Description |
|---|---|---|---|
reason | no | manual | Free-form label stored in the snapshot file, e.g. pre_xos_update |
service: xpeng.capture_snapshot
data:
reason: pre_xos_updateA snapshot is also captured automatically when an XOS version change is detected, so each OTA produces a before/after pair to diff. The files contain the VIN and the decoded VIN descriptor.
clear_stuck_commands
Clears the server-side pending vehicle command queue for your own account — the fix for code:12 "Vehicle controls in used", which is what a rapid burst of commands leaves behind. It calls REST vehicleCmdClear and affects only your account. No fields.
service: xpeng.clear_stuck_commandssend_raw_mqtt
Sends an arbitrary MQTT command to the vehicle. Advanced/debug use only.
| Field | Required | Default | Description |
|---|---|---|---|
service_type | yes | – | MQTT service_type number, e.g. 34 for CMD_TO_SCREEN, 19 for a state query; selector 0–50 |
msg_type | no | 2 | Message type; 2 = control command, 4 = query; selector 0–10 |
msg_content | no | {} | JSON string for msg_content |
service: xpeng.send_raw_mqtt
data:
service_type: 19
msg_type: 2
msg_content: '{"cmd_type": 1, "cmd_value": 1}'WARNING
There is no validation of msg_content against the car's expectations. An unknown service_type or a malformed payload can wake the car or leave a command pending server-side — which is exactly the state clear_stuck_commands exists to clear.
Credential import
import_credentials
Validates a freshly minted xpeng_tokens.json / xpeng_tenant.json pair and installs it into an existing config entry. It is the same validated path the Repairs card uses, which is the point: an unattended renewal driven by an automation is not a weaker path than a human clicking Fix. The renewal app drives exactly this service.
A renewal does not reload the entry. When the pair is for the same car — the same VIN and the same tenant deviceId — the new MQTT account is staged on the running client and it reconnects, so no entity is torn down: the values stay put and only sensor.xpeng_<car>_last_renewal moves. The entry is reloaded only when the pair describes a different car or device id, because the VIN is part of every entity id and the tenant's deviceId is the key the pair is sealed with.
The pair is proven before anything is replaced: the integration mints MQTT credentials against the live API, so a stale token file, a tenant from a different onboarding run, or a mismatched pair is refused and the working credentials stay in place. The tenant's deviceId is adopted over whatever the entry had, because the key pool is sealed against md5(deviceId).
| Field | Required | Default | Description |
|---|---|---|---|
tokens_path | no* | – | Path to xpeng_tokens.json on the Home Assistant host (read inside the HA container) |
tenant_path | no* | – | Path to xpeng_tenant.json on the Home Assistant host |
tokens_json | no* | – | The whole xpeng_tokens.json file as a string, instead of a path |
tenant_json | no* | – | The whole xpeng_tenant.json file as a string, instead of a path |
vin | no | the entry's VIN, else the VIN in the token file | VIN to store on the entry |
entry_id | no | the first XPENG entry | Which config entry to import into |
* For each half of the pair, supply either the JSON contents or a path. Missing both is the error invalid_tokens / invalid_tenant; an unreadable path is invalid_tokens_path / invalid_tenant_path.
service: xpeng.import_credentials
data:
tokens_path: /config/xpeng-secrets/xpeng_tokens.json
tenant_path: /config/xpeng-secrets/xpeng_tenant.jsonThese paths are resolved on the Home Assistant host, so a pair written by an app into its own container filesystem is not visible unless pair_dir is mapped under /config. The pair is live credentials: chmod 700 the directory and keep it out of any share. See Credentials and the pair directory.
Return value
The service is registered with SupportsResponse.ONLY, so a call must ask for the response. Over the REST API that means the ?return_response query parameter:
curl -sS -X POST \
-H "Authorization: Bearer $HA_TOKEN" \
-H "Content-Type: application/json" \
-d '{"tokens_path": "/config/xpeng-secrets/xpeng_tokens.json",
"tenant_path": "/config/xpeng-secrets/xpeng_tenant.json"}' \
"http://your-ha-host:8123/api/services/xpeng/import_credentials?return_response"Home Assistant answers with its usual service envelope, and the import result is in service_response:
{
"changed_states": [],
"service_response": {
"entry_id": "<entry-id>",
"vin": "<17-character-vin>",
"device_id": "<32-hex-device-id>",
"account": "owner@example.com",
"client_id": "xmart:app:<uid>:<device-uuid>"
}
}account is the address recorded in the token file, and is null for a pair from an onboarding run that did not record one. device_id and client_id are the credential material the new session is bound to — do not log them, publish them to a dashboard, or paste them into a forum.
A call without ?return_response is refused by Home Assistant with HTTP 400 and "Service call requires responses but caller did not ask for responses", not by the integration.
The first entry
xpeng.import_credentials cannot create the first config entry, and it is not registered until one exists: component-level setup runs only once an entry is set up, so on a brand-new install the xpeng service domain is absent from /api/services and a call to it fails with "No XPENG config entry to import credentials into" (HTTP 400).
The bootstrap is the renewal app's job, and it happens in front of this service: on a run with no entry, the app drives the config flow with the pair it just minted (start a flow for the xpeng handler, then submit the import_tokens step) and its POST /renew answers {"ok": true, "bootstrapped": "<VIN>", ...} instead of an imported result. That call also loads the component and registers this service, so every later renewal uses import_credentials normally. See Unattended renewal and App options.
Selecting the vehicle for schedules
list_hvac_schedules, create_hvac_schedule, update_hvac_schedule and delete_hvac_schedule all accept optional vehicle_entity_id. Single-car calls may omit it; multi-car calls must choose an entity belonging to the intended XPENG config entry. Unlike the other services (Choosing the vehicle), this one does not fall back to the first entry when several cars exist - it refuses, because a schedule written to the wrong car is worse than a failed call. Successful edits refresh the schedule/calendar. If an edit succeeds but refresh fails, the service reports that uncertainty rather than silently claiming the displayed list is current.
action: xpeng.list_hvac_schedules
data:
vehicle_entity_id: climate.xpeng_my_car_climate