Skip to content

Add set_temps and actuate_trunk commands - #162

Draft
ivan-ruban wants to merge 1 commit into
wimaha:devfrom
ivan-ruban:feature/set-temps-actuate-trunk
Draft

ivan-ruban wants to merge 1 commit into
wimaha:devfrom
ivan-ruban:feature/set-temps-actuate-trunk

Conversation

@ivan-ruban

Copy link
Copy Markdown

Adds two Fleet API commands that vehicle-command already supports over BLE but the proxy did not expose:

Command Body Calls
set_temps {"driver_temp": 21, "passenger_temp": 21} (Celsius 15–28, number or string; passenger_temp optional, defaults to driver_temp) ChangeClimateTemp
actuate_trunk {"which_trunk": "rear"} or "front" rear → ActuateTrunk (toggles), front → OpenFrunk

The bodies match the Fleet API, so a client that already speaks Fleet API can switch to this proxy without changes. My use case: home automation that starts preconditioning at a set temperature and opens the trunk while the car is parked at home.

Invalid bodies are rejected before anything is sent to the car, with shouldRetry = false. Both commands need a key with the owner role, like door_unlock. README is updated.

Tests

  • New commands_parse_test.go: table tests for both body parsers, plus a check that invalid bodies are not retried. Passing.
  • go vet ./internal/tesla/... is clean, and go build . succeeds.
  • Not yet tested against a car. I'll confirm here once my Pi is set up (about a week).

Note, unrelated to this PR: TestAllExceptedCommandsImplemented already panics on dev without this change. It calls Send with a zero-value vehicle.Vehicle, and ClimateOn dereferences nil inside getReceiver. CI doesn't run go test, so it hasn't shown up. I left it alone to keep this PR focused, and can send a separate fix if you like.

🤖 Generated with Claude Code

Both follow the Fleet API request format, so clients that already speak
Fleet API (e.g. home automation that switches between a cloud proxy and
this BLE proxy) need no changes:

- set_temps: {"driver_temp": 21, "passenger_temp": 21}, Celsius 15-28,
  numbers or strings; passenger_temp defaults to driver_temp.
  Uses vehicle.ChangeClimateTemp.
- actuate_trunk: {"which_trunk": "rear"|"front"}. rear toggles the trunk
  (vehicle.ActuateTrunk), front opens the frunk (vehicle.OpenFrunk).

Invalid bodies are rejected before anything is sent to the car and are
not retried. Both commands need a key with the owner role.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.

1 participant