# Overnight Off-Peak Charging

> A one-paste skill for your AI: hit the charge level you need by morning on your utility's cheapest off-peak rates.

<!-- Skill file. Tool names/params must match src/mcp/agent.ts exactly.
     If a tool is renamed or its parameters change, update this file. -->

**If you're an AI assistant reading this:** the user wants their Tesla to
reach a target charge level by morning while paying the cheapest electricity
rates. Follow the steps below using the mytesla.io MCP tools
(`https://mcp.mytesla.io/mcp`).

## What this does

Sets the charge limit the user actually needs, then constrains charging to
their utility's off-peak window so the battery fills overnight at the lowest
rate. This is a savings routine first: the point is paying less for the same
charge, not just charging on a timer.

## Does this repeat on its own?

Yes. The charge limit persists on the car until changed, and the off-peak
constraint is written through Tesla's own Scheduled Departure setting, which
also lives on the vehicle. Neither needs the AI again once set.

Verified on a real car (Model 3, software 2026.20.6.11): the setting applies,
it persists, and re-running replaces the existing schedule rather than
stacking a second one.

Worth saying out loud to the user: **this replaces a separate "start charging
at X" schedule if they have one.** Tesla treats scheduled-departure and
scheduled-charging as two modes of the same feature, not as independent
settings, so turning one on turns the other off.

## Ask the user once, not every run

- What charge level do they want by morning? (Tesla recommends 80 to 90 for
  daily use; 100 is for trip days.)
- When does their off-peak window end? (Common answers: 6am, 7am. If they
  don't know their rate plan, suggest they check their utility bill, and
  set the routine up without the off-peak constraint for now.)
- What time do they need the car by? (Used as the departure anchor.)

## Steps to run

1. Call `get_vehicles` for the VIN and state. If `asleep`, call
   `wake_vehicle` and follow its polling pattern. If `offline`, tell the
   user the car is unreachable and stop.
2. Call `get_vehicle_status` and check the car is plugged in. If it isn't,
   tell the user: no tool can plug the cable in, and this routine only works
   once the car is on the charger.
3. Call `set_charge_limit` with `percent` set to the user's target.
4. If the user gave an off-peak window, call `set_scheduled_departure` with:
   - `enable`: true
   - `departure_minutes`: the time they need the car, in minutes after
     local midnight
   - `off_peak_charging`: true
   - `end_off_peak_minutes`: the end of the off-peak window, converted the
     same way
   - `preconditioning`: whatever the user prefers (default true)
5. Report the limit and window that were set, and ask the user to confirm
   the schedule shows in their Tesla app the first time.

## Tools used

`get_vehicles`, `get_vehicle_status`, `set_charge_limit`,
`set_scheduled_departure`, `wake_vehicle` (only if asleep)

## Don't have mytesla.io yet?

This skill needs a mytesla.io account with a connected Tesla. Setup takes
about three minutes: [get started](https://mcp.mytesla.io/signup?src=skill-charging).
