Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 14 additions & 3 deletions src/rivian/parallax/charging.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,13 +165,24 @@ def decode_soc_slider(m: charging_pb2.SocSlider) -> dict[str, Any]:

@RVMDecoder.register("charging.session.trip_target", charging_pb2.TripTarget)
def decode_trip_target(m: charging_pb2.TripTarget) -> dict[str, Any]:
"""charging.session.trip_target — the trip's target state of charge.
"""charging.session.trip_target — the charge a planned trip needs.

Fields:
chargingTripTargetSoc: int | None (percent; None when not set)
chargingTripTargetMinsRemaining: int | None — minutes of charging
until the target SoC; None when no target, or when the estimate is
absent, zero or 0xFFFF
_chargingTripTargetStatus: int — raw
"""
soc = m.soc_limit
return {"chargingTripTargetSoc": None if soc in (0, 0xFFFF) else soc}
has_target = 1 <= m.soc <= 100
minutes = m.time_estimate
return {
"chargingTripTargetSoc": m.soc if has_target else None,
"chargingTripTargetMinsRemaining": (
minutes if has_target and 0 < minutes < 0xFFFF else None
),
"_chargingTripTargetStatus": m.status,
}


@RVMDecoder.register(
Expand Down
7 changes: 5 additions & 2 deletions src/rivian/parallax/proto/charging.proto
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,12 @@ message SocSlider {
optional int32 soc_limit = 1; // percent
}

// charging.session.trip_target -- unmapped.
// charging.session.trip_target -- the charge a planned trip needs. The app
// shows a trip target only while soc is 1-100.
message TripTarget {
int32 soc_limit = 2; // percent; 0xFFFF when not set
int32 soc = 1; // percent; 0 when not set
int32 time_estimate = 2; // minutes until soc is reached; 0xFFFF when not set
int32 status = 3; // enum type unknown
}

// charging.smart_charging.settings -- not seen yet; the app's likely schema.
Expand Down
Loading
Loading