Skip to content
Open
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
11 changes: 11 additions & 0 deletions src/rivian/parallax/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@
The RVM and payload of a signed lock or unlock command.
decode_command_state_message(data) -> dict | None
Reads a raw `subscribe_for_parallax_command_state` message.
encode_climate_hold(on), encode_pet_mode(on) -> bytes
Payloads for the signed SET_CLIMATE_HOLD_RVM and SET_PET_MODE_RVM
commands.

Layout:
core.py - registry, payload parsing and shared helpers
Expand Down Expand Up @@ -56,7 +59,11 @@
from .comfort import (
CLIMATE_HOLD_SETTING_RVM,
CLIMATE_HOLD_STATUS_RVM,
SET_CLIMATE_HOLD_RVM,
SET_PET_MODE_RVM,
encode_climate_hold,
encode_climate_hold_setting,
encode_pet_mode,
)
from .command import decode_command_state_message, encode_command
from .core import (
Expand Down Expand Up @@ -87,13 +94,17 @@
"CLIMATE_HOLD_STATUS_RVM",
"LOCK_RVM",
"PARALLAX_RVMS",
"SET_CLIMATE_HOLD_RVM",
"SET_PET_MODE_RVM",
"UNLOCK_RVM",
"decode_command_state_message",
"decode_parallax_message",
"decode_parallax_subscription_message",
"encode_climate_hold",
"encode_climate_hold_setting",
"encode_command",
"encode_lock",
"encode_pet_mode",
"encode_unlock",
"encode_vehicle_operation",
]
14 changes: 14 additions & 0 deletions src/rivian/parallax/comfort.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@

CLIMATE_HOLD_SETTING_RVM: Final = "comfort.cabin.climate_hold_setting"
CLIMATE_HOLD_STATUS_RVM: Final = "comfort.cabin.climate_hold_status"
SET_CLIMATE_HOLD_RVM: Final = "comfort.cabin.set_climate_hold"
SET_PET_MODE_RVM: Final = "comfort.cabin.set_pet_mode"


@RVMDecoder.register(
Expand Down Expand Up @@ -208,6 +210,18 @@ def encode_climate_hold_setting(duration_seconds: int) -> bytes:
return comfort_pb2.ClimateHoldSetting(duration=duration_seconds).SerializeToString()


def encode_climate_hold(on: bool) -> bytes:
"""Encode a comfort.cabin.set_climate_hold payload."""
action = comfort_pb2.ACTION_ON if on else comfort_pb2.ACTION_OFF
return comfort_pb2.ActionRequest(action=action).SerializeToString()


def encode_pet_mode(on: bool) -> bytes:
"""Encode a comfort.cabin.set_pet_mode payload."""
action = comfort_pb2.ACTION_ON if on else comfort_pb2.ACTION_OFF
return comfort_pb2.ActionRequest(action=action).SerializeToString()


@RVMDecoder.register(CLIMATE_HOLD_SETTING_RVM, comfort_pb2.ClimateHoldSetting)
def decode_climate_hold_setting(m: comfort_pb2.ClimateHoldSetting) -> dict[str, Any]:
"""comfort.cabin.climate_hold_setting — configured climate-hold duration.
Expand Down
12 changes: 12 additions & 0 deletions src/rivian/parallax/proto/comfort.proto
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,18 @@ message ClimateHoldSetting {
int32 duration = 1; // seconds; empty payload when no hold is set
}

// comfort.cabin.set_climate_hold and comfort.cabin.set_pet_mode; the names
// are the app's
message ActionRequest {
Action action = 1;
}

enum Action {
ACTION_UNSPECIFIED = 0;
ACTION_ON = 1;
ACTION_OFF = 2;
}

// comfort.cabin.climate_hold_status
message ClimateHoldStatus {
ClimateHoldStatusValue status = 1;
Expand Down
Loading