Repository navigation
Add starting a Gear Guard live stream - #250
Conversation
98129f0 to
8e4438b
Compare
natekspencer
left a comment
There was a problem hiding this comment.
Thanks, the command-id routing and failing fast through on_error are nicely done. Two small things:
- An exception can be left unread on the future. If
on_errorsets an exception onconfigand thensend_parallax_commandreturns falsy (or raises), the method returns or raises without awaitingconfig, so asyncio logs "Future exception was never retrieved" when it's collected. Reading it in thefinally(e.g.if config.done() and not config.cancelled(): config.exception()), or cancelling the future when you return early, would avoid that. on_errorassumes the payload is a list.errors[0].get(...)raises ifpayloadis an object, which with #249 as it is would take the receiver down instead of failing the stream. Handling both shapes (payload if isinstance(payload, list) else [payload]) would make it robust regardless of #249.
This needs a rebase once #249 lands.
|
Both fixed. The |
|
Thanks, both fixes look good. #252, #246 and #248 have been merged, so this now conflicts with They will land in this order, so rebasing in the same order keeps the later ones from conflicting again:
I've moved this to draft for now; please mark it ready for review once it's rebased. |
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.
1e37283 to
9124f99
Compare
|
Rebased onto #249 in your merge order, ready for review. |
natekspencer
left a comment
There was a problem hiding this comment.
Thanks, both fixes look good and I checked the live-streaming payload against the app: the camera values and fields match.
Builds on #249.
start_gear_guard_live_streamstarts a live camera stream like the app and returns the Kinesis Video WebRTC config (signaling endpoint, ICE servers, role) for a viewer to join.gearGuardLiveConfig, then sends the signedstart_live_streamingcommand with the same command idparallax.encode_live_streaming(newLiveStreamingRequestschema),GEAR_GUARD_CAMERASon_errorNeeds Gear Guard video monitoring on and a paired phone. The vehicle allows one session at a time, about 3 minutes each and an hour a day.
Tested
2026 R1S (Gen 2), 2026.36.01: front and right cameras streamed in a WebRTC viewer.
Not tested: rear, left and bed cameras, R2 cabin camera