Skip to content

Add Parallax equivalents of vehicle commands - #245

Merged
natekspencer merged 8 commits into
bretterer:mainfrom
walthowd:feat/parallax-vehicle-commands
Nov 16, 2026
Merged

natekspencer merged 8 commits into
bretterer:mainfrom
walthowd:feat/parallax-vehicle-commands

Conversation

@walthowd

@walthowd walthowd commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

Gen 2 R1s and the R2 refuse sendVehicleCommand for anything they take over Parallax. This maps vehicle commands to their Parallax equivalents, gated on the same supported features the Rivian app checks.

  • parallax.vehicle_command_feature: the feature that gates a command (PVS_BD_CMD, PVS_SEC_CMD, PVS_COMF_CMD, PVS_ENRG_CMD), or None if there's no equivalent (wake, honk, flash, side bins)
  • parallax.encode_vehicle_command: the RVM and payload for send_parallax_command, from the same params as send_vehicle_command, checked first with Rivian.validate_vehicle_command
  • The payloads are encode_* functions with Final RVM constants in body.py, comfort.py and charging.py

Tested

2026 R1S (Gen 2), 2026.36.01: locks, windows, frunk, liftgate, seat heat/vent (all rows), steering wheel heat, preconditioning and temp (incl. HI/LO), defrost, charge limit, start/stop charging, charge port, panic, Gear Guard video. Payloads match the Rivian app's (re-captured 2026-11-15).

Not tested: R1T (tailgate), side bins, R2

Overlap with #235

I compared the two on my R1S and the payloads match byte for byte, except LO. #235 has been quiet since, so I'm opening mine. Happy to go with whichever you'd rather merge.

@natekspencer

Copy link
Copy Markdown
Collaborator

#252, #246 and #248 have been merged, so this now conflicts with main (parallax/__init__.py). Could you rebase onto main and resolve the conflicts? Since it lands last, rebasing after #247 is in saves a second round: both change comfort.proto, so comfort_pb2.py will need regenerating with protoc rather than merging by hand.

They will land in this order, so rebasing in the same order keeps the later ones from conflicting again:

  1. Pass subscription errors to an on_error callback #249 Pass subscription errors to an on_error callback
  2. Add starting a Gear Guard live stream #250 Add starting a Gear Guard live stream
  3. Add searching for places #251 Add searching for places
  4. Add climate hold and pet mode commands #247 Add climate hold and pet mode commands
  5. Add Parallax equivalents of vehicle commands #245 Add Parallax equivalents of vehicle commands

I've moved this to draft for now; please mark it ready for review once it's rebased.

@natekspencer
natekspencer marked this pull request as draft November 15, 2026 19:13
The server ends a subscription with an `error` message when it fails, for
example when the vehicle refuses a command the subscription waits on. The
web socket only logged those at debug, so a caller waiting on the
subscription could only time out. Subscriptions can now take an `on_error`
callback that gets the error message; existing callers are unchanged.
An `on_error` that raised escaped the receive loop and ended the receiver
task. Both callbacks now run through `_run_callback`, which logs a failure
instead of raising and awaits coroutine callbacks.
`start_gear_guard_live_stream` starts a live camera stream the way the
Rivian app does and returns its Kinesis Video WebRTC config (signaling
endpoint, ICE servers and role), for a viewer to join:

- It subscribes to `gearGuardLiveConfig` with a fresh command id, then sends
  the signed `security.video_monitoring.start_live_streaming` command with
  that same id; the cloud routes the config by it.
- `parallax.encode_live_streaming` builds the command's payload from a new
  `LiveStreamingRequest` schema; `GEAR_GUARD_CAMERAS` names the cameras.
- A refused start (e.g. a camera the vehicle doesn't have) raises
  RivianApiException straight away, through the subscription's `on_error`.

It needs Gear Guard video monitoring on and a paired phone. The vehicle
serves one session at a time, about 3 minutes each and an hour a day.

Builds on bretterer#249.

Verified against a 2026 R1S (Gen 2) running 2026.36.01: the config arrived
within seconds of the start when the vehicle was awake, and the front and
right cameras streamed in a WebRTC viewer. A sleeping vehicle can take
longer to wake than the default 40 second timeout. Not tested: the rear,
left and bed cameras, the R2's cabin camera.
A refusal that reached the future before the start command was rejected
was never read, so asyncio logged "Future exception was never
retrieved"; it is now read before returning. The error handler also
takes a `payload` sent as an object, not only as a list, so it still
fails the start instead of raising in the callback.
- `search_places` searches like the Rivian app's map search (its `places`
  query): results with a Google place id, name, address, coordinates and
  the driving distance and time from where you search.
- `suggest_places` returns the app's suggested search texts for partial
  text (the same query with autocomplete), such as "restaurants" and "Red
  Lobster" for "RE", for type-ahead in front of `search_places`.
- `utils.place_url` builds the Rivian app's link for a result, which
  `send_location_to_vehicle` sends so the vehicle shows the place's name.

None of them needs a paired phone key.

Tested against the API: a search returned Google's results in under a
second, in their own order rather than nearest first, and suggestions came
back in about a tenth of a second. `maxResults` was ignored, so it is left
out.
Encoders for the payloads of the signed `comfort.cabin.set_climate_hold` and
`comfort.cabin.set_pet_mode` commands, both a single on/off action as in the
Rivian app:

    await rivian.send_parallax_command(
        vehicle_id, SET_PET_MODE_RVM, encode_pet_mode(True), ...
    )

Verified against a 2026 R1S (Gen 2) running 2026.36.01: pet mode on/off and
climate hold on/off each reported the new state within seconds. The pet mode
payloads match the app's (captured with mitmproxy); the app's climate hold
control only sets the duration (`set_climate_hold_duration`), so that
payload comes from the app's code. Not tested: Gen 1 vehicles, the R1T and
R2.
New R1s and the R2 refuse `sendVehicleCommand` for commands they take over
Parallax. Like the Rivian app, a command goes over Parallax when the vehicle
reports its category's supported feature (`PVS_BD_CMD`, `PVS_SEC_CMD`,
`PVS_COMF_CMD` or `PVS_ENRG_CMD`) as AVAILABLE. The liftgate needs
`LIFTGATE_CMD`, so vehicles without it, such as an R1T with a tailgate, keep
the old command.

- `parallax.vehicle_command_feature` returns that feature for a command, or
  None for commands without an equivalent (wake, honk, flash, side bins).
- `parallax.encode_vehicle_command` returns the RVM and payload to send with
  `send_parallax_command`, from the same `params` as `send_vehicle_command`.
  Locking uses the existing `encode_lock`/`encode_unlock`.

Verified against a 2026 R1S (Gen 2) running 2026.36.01, which reports all
four features and `LIFTGATE_CMD`: locks, windows, frunk, liftgate, front
seat heat and vent, rear and third row seat heat, steering wheel heat,
preconditioning and its temperature (including HI and LO), defrost, charge
limit, start and stop charging, charge port, panic and Gear Guard video.
The payloads match the Rivian app's. Not tested: the R1T and R2.
@walthowd
walthowd force-pushed the feat/parallax-vehicle-commands branch from 672c3c8 to 5fc9110 Compare November 15, 2026 20:31
@walthowd
walthowd marked this pull request as ready for review November 15, 2026 20:31
@walthowd

Copy link
Copy Markdown
Contributor Author

Rebased onto #247 in your merge order (so the diff shows the ones ahead until they land), and regenerated comfort_pb2 with protoc. Ready for review.

@natekspencer natekspencer left a comment •

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks for this. I checked the payloads against the Rivian app: every RVM name, field number and enum value matches, and so do the seat, steering wheel and defrost level conversions. Two things need changing before it can merge, plus a few smaller ones.

Needs changing

  1. The liftgate is gated only on LIFTGATE_CMD. vehicle_command_feature returns "LIFTGATE_CMD" for OPEN_LIFTGATE_UNLATCH_TAILGATE and CLOSE_LIFTGATE, so a caller (like home-assistant-rivian#342) sends them over Parallax whenever that one feature is available. In the app, LIFTGATE_CMD only decides whether the liftgate buttons are shown (VehicleComponentKt.isLiftgateSupported); whether a body command goes over Parallax depends only on PVS_BD_CMD, as for the other closures. So a vehicle with LIFTGATE_CMD but without PVS_BD_CMD, likely a Gen 1 R1S, would have its liftgate moved to Parallax and stop working. The description says the liftgate "also needs LIFTGATE_CMD", so I think requiring both was the intent; gating it on PVS_BD_CMD like the app would be simplest.

  2. Please follow the package's layout. The parallax package is organized by domain: each module (body.py, comfort.py, charging.py, security.py) holds its X_RVM: Final constants and encode_* functions, the way #247 and #250 just added theirs, and input validation lives in rivian.py (_validate_vehicle_command, set_climate_hold_duration). vehicle_command.py differs from that in a few ways:

    • About 15 RVM names are inline strings instead of constants in their domain modules.
    • The closure, cabin surface, defrost, temperature and charge limit payloads are built here instead of as encode_* functions in body.py, comfort.py and charging.py.
    • It raises RivianBadRequestError and re-implements the temperature, charge limit and level checks from _validate_vehicle_command; no other parallax module validates input, and two copies can drift apart.
    • Its constants aren't Final, and the _Level = … and _OFF, _LOW, _MEDIUM, _HIGH = (…) aliases are unlike the rest of the package.

    Moving the constants and encoders into their domain modules would leave vehicle_command.py as just the table from each command to its feature, RVM and encoder. For validation, sharing one set of checks with rivian.py instead of a second copy would keep them in step.

Smaller

  1. R1T tailgate. For OPEN_LIFTGATE_UNLATCH_TAILGATE the app sends TAILGATE over Parallax on an R1T (and LIFTGATE on other models). This always sends LIFTGATE, so a Gen 2 R1T falls back to sendVehicleCommand, which it refuses. It would need the vehicle model; fine as a follow-up since you haven't been able to test an R1T.
  2. Side bins. The app opens them over Parallax too: body.closures.open with SIDE_BIN_LEFT / SIDE_BIN_RIGHT, for RELEASE_LEFT_SIDE_BIN / RELEASE_RIGHT_SIDE_BIN. Also fine as a follow-up.
  3. LO comment. PreconditioningTemperatureRequest.temperature is optional float, while the app's field is a plain float, so for LO (0 °C) the app sends an empty payload and this sends an explicit 0.0. The vehicle reads both as 0.0, so it's harmless, but the comment "sent even for 0 (LO)" reads as if that's what the app does.

- The liftgate goes over Parallax with `PVS_BD_CMD`, like the other
  closures, as in the app; `LIFTGATE_CMD` only decides whether its
  controls are shown. Gating on `LIFTGATE_CMD` alone could move a Gen 1
  R1S liftgate to Parallax.
- The RVM names are `Final` constants and the payloads are `encode_*`
  functions in `body.py`, `comfort.py` and `charging.py` (`security.py`
  for panic and Gear Guard video), exported from `rivian.parallax`.
  `vehicle_command.py` is now just the table from each command to its
  feature, RVM and encoder.
- Validation lives in `rivian.py` only: `_validate_vehicle_command` is now
  the public `Rivian.validate_vehicle_command`, for callers sending the
  Parallax equivalent. It no longer turns the temperature into a string;
  `send_vehicle_command` does that itself.
- The LO comment says what the app sends: an empty payload, which the
  vehicle reads as 0 like an explicit 0.

Every command encodes exactly as before.
@walthowd

Copy link
Copy Markdown
Contributor Author

Thanks for going through it against the app. Follow-up pushed with 1, 2 and 5:

  1. Liftgate is gated on PVS_BD_CMD now, like the other closures. Fixed the description too.
  2. RVM names are Final constants and the payloads are encode_* functions in body.py, comfort.py and charging.py (security.py for panic and Gear Guard video), exported like the others. vehicle_command.py is just the command -> feature/RVM/encoder table plus the seat and steering wheel level maps. Validation only lives in rivian.py: _validate_vehicle_command is now the public static Rivian.validate_vehicle_command, so a caller sending the Parallax equivalent runs the same checks (parallax can't import rivian.py without a cycle), and the temp-to-string step moved into send_vehicle_command. home-assistant-rivian#342 will call it before encode_vehicle_command. Every command/param combo encodes byte for byte as before, and I re-captured the app today to double-check.
  3. R1T tailgate and 4. side bins: happy to do as follow-ups, but I only have an R1S, so I can't test either.
  4. Reworded the LO comment: the app sends an empty payload, and the vehicle reads both as 0.

@natekspencer natekspencer left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks, the routing fix and the validation split look good. Encodings match the Rivian app and all tests pass. I'll follow up separately so encode_vehicle_command checks its own params.

@natekspencer
natekspencer merged commit a84089b into bretterer:main Nov 16, 2026
6 checks passed
@natekspencer

Copy link
Copy Markdown
Collaborator

Follow-up on 3 and 4: #255 sends the R1T tailgate and the side bins over Parallax, and both are tested on an R1T. OPEN_LIFTGATE_UNLATCH_TAILGATE now takes the vehicle's model, so encode_vehicle_command(command, params, model=...) opens an R1T's tailgate and any other model's liftgate, like the app.

One correction to my review: I said an R1T refuses the legacy sendVehicleCommand for the tailgate. The R1T I tested opened it straight away with the legacy OPEN_LIFTGATE_UNLATCH_TAILGATE, even with PVS_BD_CMD available. It doesn't change anything now that the tailgate goes over Parallax.

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.

2 participants