feat(node-red): add charge/precondition schedule CRUD commands - #95
Conversation
Add addChargeSchedule/removeChargeSchedule and addPreconditionSchedule/removePreconditionSchedule cases to teslemetry-vehicle-command, with parameter validation and example flows.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ebeb75f468
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| startEnabled: { required: true, type: "boolean" }, | ||
| endEnabled: { required: true, type: "boolean" }, | ||
| startTime: { type: "string" }, | ||
| endTime: { type: "string" }, |
There was a problem hiding this comment.
Require times for enabled charge-schedule bounds
When a flow sets startEnabled: true without startTime, or endEnabled: true without endTime, these optional rules let validation pass and the subsequent request drops the corresponding undefined time during JSON serialization. The generated API contract documents start_time/end_time as omitted when the matching enabled flag is false (packages/api/src/client/types.gen.ts lines 16363-16369), so an enabled bound without its minutes value produces an invalid or ineffective schedule request; validate each time conditionally when its flag is true.
Useful? React with 👍 / 👎.
Intent
teslemetry-vehicle-commandnode exposed the legacysetScheduledCharging/setScheduledDeparturecommands but not the location-based charge/precondition schedule CRUD endpoints (add/removeChargeSchedule,add/removePreconditionSchedule) that@teslemetry/api'sTeslemetryVehicleApialready wraps.validateParametersrules for its required/optional fields (days of week, enabled flags, lat/lon,HH:mmtimes reusing the node's existingtimeToMinutesOfDayhelper).add*Scheduleaccepts an optionalmsg.idto update an existing schedule in place, matching the SDK/API contract (omit to create).teslemetry-vehicle-command.html.examples/all-features.jsonand a README bullet.